I have a script that runs another script for each line in a file.
When I echo
each $line
I can see the full contents of the line as expected.
Yet inside connect.sh
only $1
is set as user\ name
.
When I try using "$line"
, $1
in connect.sh
ends up being user\ name user\ password
.
How can I setup the program flow so that reboot.sh
passes each line of /tmp/history
to connect.sh
as 2 parameters.
With the end result that $1
is user\ name
and $2
is user\ password
?
reboot.sh:
if [ -e "/tmp/history" ]; then
while read -r line; do
echo $line
connect.sh $line \
&& break
done </tmp/history
fi
connect.sh:
echo $1
echo $2
/tmp/history:
user\ name user\ password