[bash]difference between script on command line and in file
Hi,
have to write a script; on the command line, it's (as one-liner): Code:
time while read line; do echo -n "$line "; grep -P -m 1 "\t[A-Z]$line" logfile |wc -l; done < <(tail db.txt) If I put it in a file Code:
while read line; Code:
wim@btd-techweb01:~/log$ sh verify.sh If I add '#!/bin/bash' at the beginning of verify.sh and make it executable, it works (again) as expected. Note: I will probably post some more questions as it needs some serious optimisation and a slight modification. |
Quote:
Quote:
|
Hi Chris,
thanks for the reply and the warning never to assume. Code:
wim@btd-techweb01:~$ which sh |
If bash is started as sh, it will enable posix behavior.
Try /bin/bash verify.sh instead. The error will go away. |
Thank you, that indeed worked as expected.
|
All times are GMT -5. The time now is 07:04 PM. |