Re: [PATCH v2] Test t5560: Fix test when run with dash
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Jan 15, 2010, 08:30 UTC
- Message-ID
- <4B5027B8.2090507@viscovery.net>
- In-Reply-To
- <1263537842-5792-1-git-send-email-tarmigan+git@gmail.com>
Tarmigan Casebolt schrieb:
> REQUEST_METHOD="GET" some_shell_function
> I can't tell from my reading of the POSIX spec whether my usage was > wrong or if dash is wrong,
According to POSIX, variables set as shown above for shell functions are not exported and retain their value after the function returns. I would not be surprised if dash got this right, and the tests fail because they were written for bash, which gets it wrong.
In particular,
f() { sh -c 'echo +$v+'; } v=x f echo +$v+ sh -c 'echo +$v+'"
Should print
++ +x+ ++
I can test only ash, bash, zsh, and ksh, of which only ksh gets it right.
-- Hannes