I want to install some tools in specific directory in install.sh
and call them in test.sh
, so I add the path like this:
# part of install.sh
path_add()
{
if [ -d "$1" ] && [ ":$PATH:" != *":$1:"* ]; then
echo "add $1 to PATH"
export PATH="$PATH:$1"
echo $PATH
else
echo "$1 already existing in PATH"
fi
}
the echo
shows that the $1
has been added to $PATH
, but when install.sh
exit, the $PATH
do not contain the specified path just added, how to add it permanently and can affect the continuing shell environment?