One line If-then-else block in csh possible?
Calvin Goodrich
calvin at sequent.UUCP
Sat Feb 16 08:42:16 AEST 1991
In article <5828 at iron6.UUCP> yeates at motcid.UUCP (Tony J Yeates) writes:
>harichan at eecae.uucp (Ronald Harichandran) writes:
>
>>Is it possible to have an if-then-else-endif block on a single line?
>
>The only thing I can think of is:-
>
>if () then ; command ; else ; command ; endif
>
>which when I try it does NOT work.
>
>The csh man page says "The words else and endif must be the first nonwhite
>characters on a line." Oh, it also describes the if() command bug mentioned above.
>Guess we're SOL!
for csh users, yes. for ksh users, no. in ksh you're allowed to use the form:
if [ expr ]; then <command>; else <other command>; fi
unfortunately, it doesn't work that way for csh. believe me, i've tried
lots-o-different combinations of ;'s but it comes back and says "else: endif
not found". apparently csh requires that the endif be on it's own line.
have a day, eh.
calvin.
Calvin Goodrich / calvin at sequent.sequent.com a\=k)4vk!%t@$+... <EOT> (beep!)
"Scotty, we need that .sig in thirty seconds or we're all dead!"
"Och, Captain! We canna do anathin'! It's still on yir other account!"
(Starfleet. It's not just an adventure, it's a job.)
More information about the Comp.unix.shell
mailing list