bug-bash
[Top][All Lists]
Advanced

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

`if $(cmd);' is a positive when there's no output from cmd


From: Herculano Einloft
Subject: `if $(cmd);' is a positive when there's no output from cmd
Date: Sat, 15 Apr 2006 20:55:01 -0300

Hey all, 

$ if $(echo string >/dev/null); then echo true; fi 
true 

This should be a syntax error, since 

$ if; then echo true; fi 
bash: syntax error near unexpected token `;' 

Tested on 

GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu) 
Copyright (C) 2002 Free Software Foundation, Inc. 

and 

GNU bash, version 3.1.7(1)-release (i386-redhat-linux-gnu) 
Copyright (C) 2005 Free Software Foundation, Inc. 

Regards 



reply via email to

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