process result code in if

2013-06-06 Thread A.P. Horst
Hi, I am trying to do a simple check to validate a value is a positive integer. There are many variations to do this but in general this should do the trick: var=100 if echo $var | grep -Eq '^[0-9]+$' /dev/null 21; then echo positive integer else echo something else fi if I put this

Re: process result code in if

2013-06-06 Thread Earnie Boyd
On Thu, Jun 6, 2013 at 5:00 AM, A.P. Horst wrote: Also when I just have: echo $var | grep -Eq '^[0-9]+$' echo $? --8-- I am on a win7 x64 machine with MinGW 3.20 and W32API 3.17 sh --version GNU bash, version 3.1.17(1)-release (i686-pc-msys) How is the var variable set? If you're using the

Re: process result code in if

2013-06-06 Thread Keith Marshall
On 6 June 2013 12:12, Earnie Boyd wrote: On Thu, Jun 6, 2013 at 5:00 AM, A.P. Horst wrote: Also when I just have: echo $var | grep -Eq '^[0-9]+$' echo $? --8-- I am on a win7 x64 machine with MinGW 3.20 and W32API 3.17 sh --version GNU bash, version 3.1.17(1)-release (i686-pc-msys)

Re: process result code in if

2013-06-06 Thread Eric Blake
- Original Message - A more robust, (and more portable), formulation may be: echo $var | grep '^+\{0,1\}[0-9]\{1,\}$' /dev/null 21 Why fork, when straight shell will do? case $var in +*) tmp=$var ;; *) tmp=+$var ;; esac case $tmp in +*[!0-9]* | +) echo not numeric ;; *)

Re: process result code in if

2013-06-06 Thread Keith Marshall
On 6 June 2013 13:41, Eric Blake wrote: A more robust, (and more portable), formulation may be: echo $var | grep '^+\{0,1\}[0-9]\{1,\}$' /dev/null 21 Why fork, when straight shell will do? case $var in ... Agreed, avoiding the fork is a good idea, and I do often use case

test for CXXLD

2013-06-06 Thread Nicolas Bock
Hi, The C++ compiler I am using (charmc) needs an additional command line argument during the linker stage (-language charm++). I am unsure how to best add this argument. The generated makefiles use CXX for compilation and CXXLD for linking, both of which are set to charmc. How would I change

Re: test for CXXLD

2013-06-06 Thread Gavin Smith
On Thu, Jun 6, 2013 at 8:08 PM, Nicolas Bock nicolasb...@gmail.com wrote: Hi, The C++ compiler I am using (charmc) needs an additional command line argument during the linker stage (-language charm++). I am unsure how to best add this argument. The generated makefiles use CXX for compilation

implement workaround for header files

2013-06-06 Thread Peter Johansson
Hi autoconfers, I have the following case: I maintain a library that uses boost heavily. Recently I learnt that boost/exception_ptr.hpp is broken with certain version of GCC (4.4.7 for example). I would like provide a workaround for users of the library (myself e.g.) so we won't even notice

Re: process result code in if

2013-06-06 Thread Miles Bader
Wait, why can't you use test $x -gt 0...? -miles -- Logic, n. The art of thinking and reasoning in strict accordance with the limitations and incapacities of the human misunderstanding. ___ Autoconf mailing list Autoconf@gnu.org

Re: process result code in if

2013-06-06 Thread Gary V. Vaughan
On 7 Jun 2013, at 08:41, Miles Bader mi...@gnu.org wrote: Wait, why can't you use test $x -gt 0...? You mean test 0 -lt $x, otherwise if x starts with a hyphen (e.g -1) things will go awry! Cheers, -- Gary V. Vaughan (gary AT gnu DOT org) ___

Re: process result code in if

2013-06-06 Thread Miles Bader
Gary V. Vaughan g...@gnu.org writes: On 7 Jun 2013, at 08:41, Miles Bader mi...@gnu.org wrote: Wait, why can't you use test $x -gt 0...? You mean test 0 -lt $x, otherwise if x starts with a hyphen (e.g -1) things will go awry! I dunno, test here (both coreutils test, and the bash builtin)