Added scripts to modify PATH. Useful for testing the scripts without copying them anywhere.

This commit is contained in:
Dragon chasing the world on a string 2023-12-05 14:50:37 -06:00
parent 780bed4541
commit ee68a72f60
4 changed files with 34 additions and 0 deletions

5
primitives/absolutedir Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
while [ "$1" != "" ] ; do
if [ -d "$1" ] ; then echo $(cd "$1" ; pwd) ; fi
shift 1
done

18
primitives/addsubdirstopath Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
absolutedir () {
while [ "$1" != "" ] ; do
if [ -d "$1" ] ; then echo $(cd "$1" ; pwd) ; fi
shift 1
done
}
if [ -d "$1" ] ; then
DIR="$1"
else
DIR="$(pwd)"
fi
export ALT_PATH="${PATH}"
for directory in $(ls --file-type "$DIR" | grep '/' | sed 's/\///') ; do
export PATH="${PATH}:$(absolutedir $DIR/$directory)"
done

8
primitives/togglepathadditions Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ "$ORIG_PATH" != "" ] ; then
ALT_PATH_LOCAL="${ORIG_PATH}"
export ALT_PATH="${PATH}"
export PATH="${ORIG_PATH_LOCAL}"
else
echo "No original path to toggle." >&2
fi

3
testenv Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
. primitives/addsubdirstopath
$SHELL