Suppose I have in main.sh:
$NAME="a string"
if [ -f $HOME/install.sh ]
. $HOME/install.sh $NAME
fi
and in install.sh:
echo $1
This is supposed to echo "a string"
, but it echoes nothing. Why?
|
Michael Mrozek covers most of the issues and his fixes will work since you are using Bash. You may be interested in the fact that the ability to source a script with arguments is a bashism. In When you source the script in
|
|||||||||
|
I see three errors:
|
|||||||||||||||||
|
simply set your parametrs before sourcing the script ! main.sh
install.sh
test
|
|||
|