[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unset FOO
From: |
Peter Seebach |
Subject: |
Re: unset FOO |
Date: |
Tue, 14 Oct 2008 11:42:51 -0500 |
In message <address@hidden>, Eric Blake writes:
>Quotes won't help; the shell then tries to evaluate the command 'unset FOO'
>with no arguments, because there is no reason to do IFS splitting.
Doh.
>But this works, using an intermediate variable, so that IFS splitting still
>occurs:
>$ /bin/sh -c 'foo=a;tmp="unset foo";${foo+$tmp};echo ${foo+set}'; echo $?
>0
>$
Oh, that's neat.
>But why waste the time going through a temporary variable, when you can use:
>test ${foo+set} = set && unset foo
That is clearer, true.
-s