I am trying to pass a variable as an argument to another script. While substitution of variable, I am facing a problem.
varaiable "a" value should be -b "FPT MAIN".
When we pass "a" to another script, we are expecing it to get substitue as ./test.sh -b "FPT MAIN". But, it is getting substituted as ./test.sh -b '"FPT' 'MAIN"', which is causing a problem.
The problem is in how the shell is interpreting the $a at the invocation of the other script. $a is interpreted as 3 arguments because three are two whitespace in $a. "$a" is interpreted as a single argument because it sees the quotes around the $a. Use my solution: eval causes the shell to interpret the $a as two arguments, which is what you need.