Tiny Core Linux
General TC => Programming & Scripting - Unofficial => Topic started by: mocore on August 31, 2024, 08:01:52 AM
-
a script for those to lazy or board of repeatedly typing
nano $(which _some_script_in_path_ )
ect ..
#path2.sh
# echo(default) full path to any script in $PATH ,
# optionally prefix the cmd_path with other command eg nano/cat/file ect
[ -z $dbg ] || set -x ; #
_cmd=$1
_run=${2-echo} # set default to echo
[ $# -eq 1 ] && shift # enable extra args
[ $# -eq 2 ] && shift 2
cmd_path=$( which $_cmd )
# run cmd passing args
$_run $cmd_path "$@"
#eg
# edit this(or any other) script ( in $PATH )
# path2.sh path2.sh nano
#- print this script
# path2.sh path2.sh cat
#- debug this script
# path2.sh path2.sh "sh -x"
#- WTF
# export dbg=y path2.sh path2.sh "exec" path2.sh cat
:o
(obviously) simpler (https://forum.tinycorelinux.net/index.php/topic,26637.0.html) yet also
similar in some ways (prefixing & arg juggling ) to : ' a shell repl function ' https://forum.tinycorelinux.net/index.php/topic,26193.0.html
aka * https://github.com/mchav/with - Command prefixing for continuous workflow using a single tool.
*mchav/with requires bash
-
for those who are forgetful/unfamiliar with the concept
its useful because it helps u type less ;)
The PATH variable makes it easy to run commonly used programs located in their own folders.
https://en.wikipedia.org/wiki/PATH_(variable)
from a topic about
modifying PATH in core
Hi PDP-8
Take a look inside ~/.profile for adding paths.
on a bit of a tangent wrt .profile
Looks like additions to .profile probably need to be added above this section of the file in order to be seen:
TERMTYPE=`/usr/bin/tty`
[ ${TERMTYPE:5:3} == "tty" ] && (
[ ! -f /etc/sysconfig/Xserver ] ||
[ -f /etc/sysconfig/text ] ||
[ -e /tmp/.X11-unix/X0 ] ||
startx
)
generally on the topic
https://unix.stackexchange.com/questions/227989/complete-view-of-where-the-path-variable-is-set-in-bash