Stupid Bash Trick: Make StackScripts work from a shell
Some of the functions I wrote up in my StackScripts were so cool, I wanted to use them after the machine was installed. However, on a StackScript where there are
So, we include the
case "$-" in
*i*)
PATH=$(cd ${0%/*} && pwd -P)
source "${PATH}/bash_lib_rh.sh"
source "${PATH}/drupal_lib_rh.sh"
;;
*)
source '<ssinclude stackscriptid="154">'
source '<ssinclude stackscriptid="162">'
;;
esac</ssinclude></ssinclude>
The only thing you have to do after using this code is to make sure you export your UDF variables before you run anything.
2 Replies
tty
> 0
Standard input is a terminal.
1
Standard input is not a terminal.
1
An error occurred.
if [ -t 0 ]
then
echo STDIN is connected to a terminal
else
echo No terminal
fi