On Sat, May 05, 2001 at 02:34:47PM -0700, Karsten M. Self wrote:
> This came up on another list. The problem involves testing existence of
> a Unix shell variable from another program with limited system
> interaction features.
...
>$?MYVAR
>
> ...which allows testing of presence of a variabl
on Sun, May 06, 2001 at 01:54:26PM +0300, Tommi Komulainen ([EMAIL PROTECTED])
wrote:
> On Sat, May 05, 2001 at 07:25:35PM -0700, Karsten M. Self wrote:
> > on Sun, May 06, 2001 at 02:22:40AM +0300, Tommi Komulainen ([EMAIL
> > PROTECTED]) wrote:
> > >
> > > if test "${LANG+set}" = set; then LAN
Lo, on Saturday, May 5, Ethan Benson did write:
> On Sat, May 05, 2001 at 02:34:47PM -0700, Karsten M. Self wrote:
> > This came up on another list. The problem involves testing existence of
> > a Unix shell variable from another program with limited system
> > interaction features.
> >
> > I us
On Sat, May 05, 2001 at 07:25:35PM -0700, Karsten M. Self wrote:
> on Sun, May 06, 2001 at 02:22:40AM +0300, Tommi Komulainen ([EMAIL
> PROTECTED]) wrote:
> >
> > if test "${LANG+set}" = set; then LANG=C; export LANG; fi
>
> Close, but not quite. It's probably the nearest thing to a winner I've
on Sun, May 06, 2001 at 02:22:40AM +0300, Tommi Komulainen ([EMAIL PROTECTED])
wrote:
> On Sat, May 05, 2001 at 02:34:47PM -0700, Karsten M. Self wrote:
> >
> > In contrast, csh and derivatives have:
> >
> >$?MYVAR
> >
> > ...which allows testing of presence of a variable.
> >
> > ...but I
"Karsten M. Self" writes:
> ...but I'm not aware of a similar bash/korn/bourne feature. Anyone?
if [ "${VAR:-invalid" = "invalid" ] ;
echo "Unset"
fi
?
--
Alan Shutko <[EMAIL PROTECTED]> - In a variety of flavors!
Happiness is the greatest good.
On Sat, May 05, 2001 at 02:34:47PM -0700, Karsten M. Self wrote:
> This came up on another list. The problem involves testing existence of
> a Unix shell variable from another program with limited system
> interaction features.
>
> I usually write this in bash as:
>
> if [ x${MYVAR} = x ]; t
On Sat, May 05, 2001 at 04:35:02PM -0700, Karsten M. Self wrote:
> >
> > Some bourne shells don't like testing variables that don't exist yet.
>
> That's precisely what we're trying to test.
where you run in to trouble really is when you don't quote the
variable, for example:
if [ $FOO = bar ]
on Sat, May 05, 2001 at 04:08:26PM -0700, Eric G. Miller (egm2@jps.net) wrote:
> On Sat, May 05, 2001 at 02:34:47PM -0700, Karsten M. Self wrote:
> > This came up on another list. The problem involves testing existence of
> > a Unix shell variable from another program with limited system
> > inter
On Sat, May 05, 2001 at 02:34:47PM -0700, Karsten M. Self wrote:
>
> In contrast, csh and derivatives have:
>
>$?MYVAR
>
> ...which allows testing of presence of a variable.
>
> ...but I'm not aware of a similar bash/korn/bourne feature. Anyone?
Coming soon to ./configure scripts near you
On Sat, May 05, 2001 at 02:34:47PM -0700, Karsten M. Self wrote:
> This came up on another list. The problem involves testing existence of
> a Unix shell variable from another program with limited system
> interaction features.
>
> I usually write this in bash as:
>
> if [ x${MYVAR} = x ]; t
also sprach Karsten M. Self (on Sat, 05 May 2001 02:34:47PM -0700):
> ...but I'm not aware of a similar bash/korn/bourne feature. Anyone?
if [ "$variable" ]; then ...
martin; (greetings from the heart of the sun.)
\ echo mailto: !#^."<*>"|tr "<*> mailto:"; [EMAIL PROTECTED]
--
This came up on another list. The problem involves testing existence of
a Unix shell variable from another program with limited system
interaction features.
I usually write this in bash as:
if [ x${MYVAR} = x ]; then
echo 'MYVAR doesn't exist (or isn't set)'
else echo "MYVAR
13 matches
Mail list logo