I upgraded from r23611 to r23885. I changed busybox "Test builtin" to off.
One of my scripts isn't working anymore:
# [[ -r /tmp/ddns_ip ]] ; echo $?
# [[ -w /tmp/ddns_ip ]] ; echo $?
# [[ -r /tmp/ddns_ip && -w /tmp/ddns_ip ]] ; echo $?
[[: missing ]]
Is this a bug or am I doing something really stupid at this late hour of the night?
[[ is an alias for the busybox
test command. Does single bracket still work?
I know it's the same, that's why I mentioned that change.
Single bracket doesn't work. AFAIK, it's also the same as test and double bracket.
[[ is a bashism and not defined in POSIX shell, don't use it.
Thank you both. I didn't know that. I always thought that [[ is a more advanced version of [ and that busybox uses [[ for both.
I wonder why it worked with "Test builtin" config option? Or maybe there was some other change that I made?
Maybe this works?
[[ -r /tmp/ddns_ip && -w /tmp/ddns_ip ]] && echo $?
There is no reason not to use:
if [ -r /tmp/ddns_ip ] && [ -w /tmp/ddns_ip ]; then
echo 0 1>&2
echo 1 1>&2
and keep it POSIX compliant.