[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Differing behaviour of shells regarding simple commands with parameter assignments



Hi,

I just stepped over a difference between bash and busybox. To illustrate I 
wrote this simple script:

----------
#!/bin/sh

bar () { echo -n $foo; }

foo=1
bar
foo=2 bar
bar
----------

bash, zsh, posh output 121

busybox sh, dash, (m)ksh output 122

checkbashisms doesn't complain.

Which of the three is wrong? Where shall I file bugs?

When bar is not a function but an external script the output is 121 with all 
the shells.


Greetings
Timo

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: