On 25/04/2008, michael <cs@networkingnewsletter.org.uk> 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 1 2 3"
$ echo "Single: " '${TEST}'
$ echo "Double: " "${TEST}"
Returns this:
Single: ${TEST}
Double: Testing 1 2 3
Or in a script like your case:
$ cat tmp.sh
#!/bin/sh
grep -e "$1" "$2"
Running this:
$ echo "1 2 3 4 5" > tmp.txt
$ ./tmp.sh "1 2 3" tmp.txt
Returns the line.
cheers,
Owen.
echo nope
sleep 60
done
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org