Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about "if" and "case" statement basics

17 views
Skip to first unread message

kp400sf

unread,
Feb 14, 2009, 5:28:10 PM2/14/09
to
Do 'if' and "case" statements need to be run as part of a shell script
or can they be run from the shell command line prompt?

Barry Margolin

unread,
Feb 15, 2009, 12:09:47 AM2/15/09
to
In article
<a03f08cf-0949-49e6...@w24g2000prd.googlegroups.com>,
kp400sf <kp4...@gmail.com> wrote:

> Do 'if' and "case" statements need to be run as part of a shell script
> or can they be run from the shell command line prompt?

Anything in a script can be done at the prompt. When you run a script,
it's the same shell, it's just reading the commands from the file
instead of a terminal.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***

Ryan McCoskrie

unread,
Jul 1, 2009, 6:24:51 PM7/1/09
to
kp400sf wrote:

> Do 'if' and "case" statements need to be run as part of a shell script
> or can they be run from the shell command line prompt?

If you want to have a multi-line command at the prompt place it in quotes.
I've only done that under bash though to your mileage may vary.

Barry Margolin

unread,
Jul 1, 2009, 8:33:29 PM7/1/09
to

> Do 'if' and "case" statements need to be run as part of a shell script
> or can they be run from the shell command line prompt?

Anything you can put in a script can be done from the shell prompt, it's
the same shell.

Ryan McCoskrie

unread,
Jul 1, 2009, 11:17:48 PM7/1/09
to
Ryan McCoskrie wrote:

s/to/so/


0 new messages