Re: questions about colon ":" command
From: Janis Papanagnou (Janis_Papanagnou_at_hotmail.com)
Date: 04/04/05
- Next message: Heiner Steven: "Top 10 posters comp.unix.shell"
- Previous message: Keith Thompson: "Re: variable with "-" sign"
- In reply to: Chris F.A. Johnson: "Re: questions about colon ":" command"
- Next in thread: Dale Hagglund: "Re: questions about colon ":" command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 04 Apr 2005 00:20:31 +0200
Chris F.A. Johnson wrote:
>
>>>Janis Papanagnou <Janis_Papanagnou@hotmail.com> said:
>>>>
>>>>if command
>>>>then :
>>>>else anothercommand
>>>>fi
>
> It is rarely needed in this context. There are ways to avoid it,
> e.g.:
True. You can work around that pattern in a couple of ways.
Though (if I had '!' not available) I'd prefer the above for clarity
and better legibility (and things get worse, IMO, as the conditions
get more complex).
> command || {
> ## commands here
> }
>
> ##############
>
> command
> if [ "$?" -ne 0 ]
> then
> ## commands here
> fi
Janis
- Next message: Heiner Steven: "Top 10 posters comp.unix.shell"
- Previous message: Keith Thompson: "Re: variable with "-" sign"
- In reply to: Chris F.A. Johnson: "Re: questions about colon ":" command"
- Next in thread: Dale Hagglund: "Re: questions about colon ":" command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|