[comp.unix.wizards] Expressions in csh IF commands

dap@aber-cs.UUCP (Dave Price) (01/20/87)

Can someone please tell me what is wrong with the following
apparently faulty IF in csh.

	if ( \{ /bin/true \} ) echo "hello"

man csh expression description paragraph says you
can use commands in {} however all the above
produces is IF syntax error.....
Dave Price

UUCP : { ENGLAND or WALES }!ukc!aber-cs!dap
JANET: dap@uk.ac.aber.cs           PHONE:    +44 970 3111 x 3267	
Post: University College of Wales, Penglais, Aberystwyth, UK, SY23 3BZ.

-- 
UUCP : { ENGLAND or WALES }!ukc!aber-cs!dap
JANET: dap@uk.ac.aber.cs           PHONE:    +44 970 3111 x 3267	
Post: University College of Wales, Penglais, Aberystwyth, UK, SY23 3BZ.

ballou@brahms.Berkeley.EDU (Kenneth R. Ballou) (01/23/87)

In article <15@aber-cs.UUCP> dap@aber-cs.UUCP (Dave Price) writes:
>Can someone please tell me what is wrong with the following
>apparently faulty IF in csh.
>
>	if ( \{ /bin/true \} ) echo "hello"
>
>man csh expression description paragraph says you
>can use commands in {} however all the above
>produces is IF syntax error.....

The correct syntax is 

	if { /bin/true } echo "hello"

The parentheses are unnecessary.
--------
Kenneth R. Ballou			ARPA:  ballou@brahms.berkeley.edu
Department of Mathematics		UUCP:  ...!ucbvax!brahms!ballou
University of California
Berkeley, California  94720

jsdy@hadron.UUCP (Joseph S. D. Yao) (02/06/87)

In article <801@cartan.Berkeley.EDU> ballou@brahms.Berkeley.EDU (Kenneth R. Ballou) writes:
>In article <15@aber-cs.UUCP> dap@aber-cs.UUCP (Dave Price) writes:
>>Can someone please tell me what is wrong with the following
>>	if ( \{ /bin/true \} ) echo "hello"
>The correct syntax is 
>	if { /bin/true } echo "hello"
>The parentheses are unnecessary.

Ken is, of course, correct, albeit nonresponsive.

The answer to the question is that the {}'s should not be
quoted.  The ()'s may be in or not at your option.

You'll need them if you add any and'ed or or'ed expressions.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}
			jsdy@hadron.COM (not yet domainised)