Re: scripting - how to handle blanks

2008-04-26 Thread Bob Proulx
michael wrote: > echo Usage\: $0 [string file] > echo To loop until \$string found in \$file Better to quote the entire line. Because [...] is special to the shell the [string file] will try to file glob match against files in the local directory. It is unlikely to match in this case but

Re: scripting - how to handle blanks

2008-04-24 Thread Owen Townend
On 25/04/2008, michael <[EMAIL PROTECTED]> wrote: > > > while [[ `grep -e ${STRING} ${FILE} |wc -l` -lt 1 ]];do This should fix it: while [[ `grep -e "${STRING}" "${FILE}" |wc -l` -lt 1 ]];do The shell still replaces variable within "" quotes, but not within ''. e.g. this: $ TEST="Testing

Re: scripting - how to handle blanks

2008-04-24 Thread michael
On Thu, 2008-04-24 at 16:02 +, Mark Clarkson wrote: > On Thu, 24 Apr 2008 16:52:14 +0100, michael > <[EMAIL PROTECTED]> wrote: > > Folks, I wish to do something like the following in a bash script but > > can't work out the correct incantation of escape chars etc so any advice > > welcome! ie w

Re: scripting - how to handle blanks

2008-04-24 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/24/08 10:52, michael wrote: > Folks, I wish to do something like the following in a bash script but > can't work out the correct incantation of escape chars etc so any advice > welcome! ie what is it I need to do for env var STRING and the grep >

scripting - how to handle blanks

2008-04-24 Thread michael
Folks, I wish to do something like the following in a bash script but can't work out the correct incantation of escape chars etc so any advice welcome! ie what is it I need to do for env var STRING and the grep command so that grep -e $STRING handles the space in STRING correctly. Ta, Michael #!