a little script

Tim Writer tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org
Tue Jan 27 20:16:52 UTC 2004


John Macdonald <jmm-TU2q2He6PgRlD5gtYiU6kEEOCMrvLtNR at public.gmane.org> writes:

> On Tue, Jan 27, 2004 at 10:48:45AM -0500, Tim Writer wrote:
> > Chris Aitken <aitken-BwLjziHGQLusTnJN9+BGXg at public.gmane.org> writes:
> > 
> > > Paul Mora wrote:
> > > >
> > > > Here's a very simple example script to do what you want (I know, I'll
> > > > probably be flamed by the scripting experts out there):
> > > >
> > > > #!/bin/bash
> > > > #
> > > > # Simple script to stop printing services and unload the parallel
> > > > # port module
> > > > service cups stop
> > > > modprobe -r lp
> > > > exit 0
> > > 
> > > I type all that into vi?
> > 
> > Any text editor, vi is fine.
> > 
> > > Are the #'s remarks or do they represent the command
> > > prompt ($ on my rh 7.3 system)?
> > 
> > They are remarks (comments).
> 
> But don't just throw them all away.
> 
> When the script is run by bash, they are treated by
> bash as comments.
> 
> However, that first line is not totally a comment -
> it can serve a functional purpose too.  When the
> first line of a text file starts with #! (in column
> 1, no leading spaces) the rest of the line can be
> used to indicate the program that will interpret
> this script (in this case /bin/bash).

Yes, I should have mentioned that.  Perhaps it's worth pointing out that
/bin/sh is the default if the script doesn't begin with #!.

-- 
tim writer <tim-s/rLXaiAEBtBDgjK7y7TUQ at public.gmane.org>                                  starnix inc.
905.771.0017 ext. 225                           thornhill, ontario, canada
http://www.starnix.com              professional linux services & products
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list