Hi,
The following code the difference between an local variable assignment
and non local variable assignment wrt to "$?". Is this documented?
Should the result be consistent between the two scenarios? Thanks.
~/linux/test/bash/man/shell_grammar/simple_commands/=$ cat main1.sh
#!/usr/bin/env bash
function cmd {
local str=$(readlink -f -e xxxx)
echo $?
}
cmd
str=$(readlink -f -e xxxx)
echo $?
readlink -f -e xxxx
echo $?
~/linux/test/bash/man/shell_grammar/simple_commands/=$ ./main1.sh
0
1
1
--
Regards,
Peng