[colug-432] Bourne v Bash Subtlety
jep200404 at columbus.rr.com
jep200404 at columbus.rr.com
Tue Jan 12 13:52:13 EST 2016
I was burned by a subtle difference between Bourne shell and bash.
lunch at phyphompho:~/20160113$ ./p1.sh hello world
p3 $1: hello
p3 $@: hello world
p3 $1: hello
p3 $@: hello world
lunch at phyphompho:~/20160113$ ./p2.sh hello world
p3 $1: hello
p3 $@: hello world
p3 $1: moby
p3 $@: moby grape
lunch at phyphompho:~/20160113$ ll p*
-rwxrwxr-x 1 lunch lunch 42 Jan 12 11:48 p1.sh
-rwxrwxr-x 1 lunch lunch 44 Jan 12 11:48 p2.sh
-rw-rw-r-- 1 lunch lunch 36 Jan 12 11:48 p3.sh
lunch at phyphompho:~/20160113$ head p*
==> p1.sh <==
#!/bin/sh
. ./p3.sh
. ./p3.sh moby grape
==> p2.sh <==
#!/bin/bash
. ./p3.sh
. ./p3.sh moby grape
==> p3.sh <==
echo "p3 \$1: $1"
echo "p3 \$@: $@"
lunch at phyphompho:~/20160113$ diff p1.sh p2.sh
1c1
< #!/bin/sh
---
> #!/bin/bash
lunch at phyphompho:~/20160113$
61pho is a cute pun
More information about the colug-432
mailing list