I am trying to learn and write Bash scripts. The problem I am facing is to execute a command with parameters including spaces stored in a variable.
Let me give you a small example. A simple script contains a single line to print the parameter passed:
test.sh
#!/bin/bash
echo $1
If I run ./test.sh "Abcd Efgh"
from the bash shell, it successfully prints Abcd Efgh
But if I put the command in a variable comm='./test.sh "Abcd Efgh"'
and then run $comm
, it print "Abcd
Could you please help me to solve this so that I can print Abcd Efgh
in the second case as well?
Thanks in advance.
-ADR