Reputation: 521
I need to send a variable to another script (BASH) and uset after in this first script. The code goes something like this:
read var
source myscipt.sh $var
echo $var
The problem is that if y put spaces when entering $var after sending it to myscript.sh I only have the first one.
NOTE: In myscript.sh I only use $1 does this have something to do with the problem?
Thanx!!!
Upvotes: 0
Views: 70
Reputation: 4384
You need to use quotes. Thus var will be considered as only one parameter, even if it contains spaces.
source myscipt.sh "$var"
Upvotes: 4