| PLEX86 | ||
|
iterating over bash script params, preserving whitespace 7260iterating over bash script params, preserving whitespace 7261 On Mon, 19 Dec 2005 17:42:34 +0000, Jules hmmm, further to this though, how do I handle pbutting parameters that need to be quoted... On Mon, 19 Dec 2005 17:42:34 +0000, Jules hmmm, further to this though, how do I handle pbutting parameters that need to be quoted when calling from another script? say I've got a script ('t.sh') containing the following: #!-bin-sh echo first is $1 echo second is $2 echo third is $3 ... and I call it from a script such as the following: #!-bin-sh params='"1st param" "2nd"' echo ${params} t.sh ${params} ... then I'll see the parameters quoted in the echo statement in the first script, but the second script will see three parameters, split at whitespace, and with the quote characters included as part of the parameter data. (if I just invoke t.sh from the login shell with quotes around the parameters then I see the quoting working as expected) Is there any way for my first script to call t.sh and pbutt the parameters correctly, so that the quotes are treated as parameter boundaries - rather than being treated as literal characters? (unfortunately for what I'm trying to do I need to call t.sh with a variable number of parameters - so I can't quote them at the point that t.sh is called but instead need to build them up into an argument list first) iterating over bash script params, preserving whitespace 7262 On Mon, 19 Dec 2005 23:19:04 +0000, Paul Colquhoun thanks - I'll give that one a try. My... cheers Jules
|
||||
iterating over bash script params, preserving whitespace 7261 Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||