I am trying to convert a simple script that I wrote from zsh to /bin/sh, but it seems that the behavior of the -n option for conditional tests is different from zsh.
Example from zsh:
And in sh:
Can anyone explain this, and a possible work around that I can use?
Example from zsh:
Code:
if [[ -n `pgrep xmms2d` ]]; then
echo "This code will not be run."
fi
And in sh:
Code:
if [ -n `pgrep xmms2d` ]; then
echo "This code will run."
fi
Can anyone explain this, and a possible work around that I can use?