OK. I decided to do a little test with BASH and ASH scripts to compare
them. I was having problems passing some variables to a function(), so
this is what I came up with.
#!/bin/sh -e
blah=1
blee=2
fcn_echo() {
echo "blah=$blah blee=$blee"
}
fcn_echo
blah=a
fcn_echo
blah=b fcn_echo
blah=c ; fcn_echo
Here's the output:
[16:51:30] chad at cyan (521)$ bash blah.sh
blah=1 blee=2
blah=a blee=2
blah=b blee=2
blah=c blee=2
[16:52:22] chad at cyan (522)$ bash --posix blah.sh
blah=1 blee=2
blah=a blee=2
blah=b blee=2
blah=b blee=2
[16:52:36] chad at cyan (523)$ ash blah.sh
blah=1 blee=2
blah=a blee=2
blah=b blee=2
blah=c blee=2
(Yes, the blee variable was extraneous.) Check out how bash changes its
behavior. ash claims to be the /most/ POSIX compliant sh interpretor.
Why, then, does bash change its output when invoked with the --posix
switch (or when called as /bin/sh)?
Ugh, what other BASH'isms or ASH'isms do we have to worry about?!
--
Chad Walstrom <chewie at wookimus.net> | a.k.a. ^chewie
http://www.wookimus.net/ | s.k.a. gunnarr
Get my public key, ICQ#, etc. $(mailx -s 'get info' chewie at wookimus.net)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20020315/058e79f1/attachment.pgp