Sending a parameter with space to another script in bash
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?
You need to use quotes. Thus var will be considered as only one parameter, even if it contains spaces.
source myscipt.sh "$var"