In <h49gnk$6n...@ger.gmane.org>, Raphael Geissert wrote: >Alexandre Rossi wrote: >>> And the script doesn't correctly handle the case where the default file >>> has been removed (it expects the vars to be always defined). The >>> Xsession script doesn't handle an unset DEEJAYD_DISPLAYNAME and >>> DEEJAYD_XAUTHORITY vars either. [ -r ] is evaluated to true. >> >> [ -r ] behaves correctly both with bash and sh on my lenny box. Not >> sure I understand what to do here. > >What I meant was that: >$ foo=/foo/bar; [ -r $foo ] && echo hello world
Looks normal, assuming /foor/bar doesn't exist on your system. >$ unset foo; [ -r $foo ] && echo hello world >hello world >$ unset foo; [ -r "$foo" ] && echo hello world ><nothing> Both these are required behavior by SUSv2. In the first, you are passing 2 arguments to the '[' command, after removing the trailing ']' only one argument remains. In that case the '[' (or test) command is required to return 0 (succeed) if the argument is non-empty and return non-0 (fail) if the argument is empty. -- Boyd Stephen Smith Jr. ,= ,-_-. =. b...@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/
signature.asc
Description: This is a digitally signed message part.