Re: OT: Which tool, and how, to get partial string from file?
On Fri, Aug 20, 2004 at 11:40:18PM -0500, Kent West wrote:
> Stefan O'Rear wrote:
> Just as a side question . . . . Some things I've read over the years
> indicate that a conditional needs to be in brackets, ...
[ is a command.
if [ x = y ]
is an if command using the test [ x = y ]
[ x = y ] succeeds if x is equal to y.
It isn't, so the if isn't run.
> ... and some indicate
> that the word "then" should be on the same line as the conditional
> following a semi-colon...
(a) if foo
then
scream
fi
and
(b) if foo; then
scream
fi
are exactly the same. It's a matter of preference.
> ... Is there any canonical structure to an
> if-then-else statement in BASH, or are there four or five ways of
> styling the statement? ...
Just like C, shell gives you ten gazillion ways to format any given
piece of code.
Reply to:
- References:
- OT: Which tool, and how, to get partial string from file?
- From: Kent West <westk@acu.edu>
- Re: OT: Which tool, and how, to get partial string from file?
- From: "Miquel van Smoorenburg" <miquels@cistron.nl>
- Re: OT: Which tool, and how, to get partial string from file?
- From: Kent West <westk@acu.edu>
- Re: OT: Which tool, and how, to get partial string from file?
- From: Kent West <westk@acu.edu>
- Re: OT: Which tool, and how, to get partial string from file?
- From: Kent West <westk@acu.edu>
- Re: OT: Which tool, and how, to get partial string from file?
- From: Kent West <westk@acu.edu>
- Re: OT: Which tool, and how, to get partial string from file?
- From: Stefan O'Rear <stefanor@cox.net>
- Re: OT: Which tool, and how, to get partial string from file?
- From: Kent West <westk@acu.edu>