On Sat, Aug 7, 2010 at 6:52 AM, steve steve@lonetwin.net wrote:
On 08/07/2010 01:11 AM, Rony wrote:
Hello, [...snip...] if queryA ; then echo Output1 else echo output2 fi
if queryB ; then echo output3 else echo output4 fi
[...snip...] I am getting syntax errors for 'fi'. What is the correct syntax for the above combination? Thanks in advance for any help.
That looks right. What is the exact error you get ?
$ cat test.sh #!/bin/bash
if [ "$1" == 1 ] ;then echo "statement 1" else echo "statement 3" fi
if [ "$2" == 2 ] ;then echo "statement 2" else echo "statement 4" fi $ ./test.sh statement 3 statement 4 $ ./test.sh 1 2 statement 1 statement 2
I don't see any error in this.
$ bash --version GNU bash, version 3.2.39(1)-release (i486-pc-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc.
HTH