autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: configure.ac


From: John Burger
Subject: Re: configure.ac
Date: Sun, 9 Mar 2003 13:53:32 -0500

Bob Proulx scripted:

  var=-abcdefg
  echo test "$var" = yes
  test -abcdefg = yes

What does 'test' do with that argument?  In this case it can tell that
it is a string and everything will parse.  But test can get confused
by that leading '-' and will think it is an option in some cases.
Therefore to stop test from seeing the leading '-' a long standing
rule has been to put another character before it.

  var=-abcdefg
  echo test "x$var" = xyes
  test x-abcdefg = xyes

Has anyone seen the following?

  test yes = "$var"

Obviously, this isn't possible if both of the comparands (!) are variables, but that's an unusual case, in my (limited) experience. Or is the reversal of the usual idiom just too jarring? Of course, this is recommended by some for C code, to catch = vs == typos.

- John Burger
  MITRE






reply via email to

[Prev in Thread] Current Thread [Next in Thread]