Bash Scripts-HowTo

Grumpy_Penguin grumpypenguin at qwest.net
Sun Sep 10 21:36:20 BST 2006


On Sunday 10 September 2006 01:04 pm, Leonard Chatagnier wrote:
> > On Saturday 09 September 2006 15:56, Leonard
> >
> > Chatagnier wrote:
> > > Would appreciate the correct command and syntax
> >
> > I think you want:
> >
> > /bin/bash -c "sudo appname"
>
> Thanks for this. Will try it soon.
>
> > from the command line run a script with:
> > sh myscript.sh
>
> Are you saying that you can run the script from the
> konsole with "sh myscript.sh" also in addition to
> "/bin/bash -c "sudo appname"". Sorry to be so dumb on
> the subject but I only attempt to run script out of
> absolute necessity.
>
> > If the script has the "shebang" line at the top,
> > then bash will use the
> > correct interpreter, and you can just run ./myscript
> > e.g.
>
> Never seen the "shebang" line at top of any script
> file. guess I need to look harder. What I do see at
> the top of most script files is "!/bin/sh". Could you
> list at least one script in Kubuntu with that
> beginning line.?
>
> > #!/bin/bash
>
> Duhh, confused here; please stay with me. Is the root
> command "!/bin/bash" the correct one to use and not
> !/bin/sh?  At the start of every script file I look
> at, is the command? !/bin/sh which I thought
> successfully ran the script in the past. Maybe I
> misremember. Would you please elaborate on this so I
> may fully understand.
>
> > .....
> >
> > or for Perl scripts:
> >
> > #!/usr/bin/perl
> > .....
> >
> > Personally I like to use extensions like .sh or .pl
> > so I know what kind
> > of script it is, but you don't need to.
>
> I haven't the slightest understanding of this.
> Guessing that .sh is a shell script and .pl is a Perl
> script and each requires the correct command line
> syntax as you mentioned above.
>
> > Marcus
>
> Thanks for trying to help. Obviously I'm a hard fix on
> this and have little knowledge on running scripts. I'm
> open to any reference on running the script but
> definitely not writing or understanding what the
> script is doing. Thanks again.
This book will getyou started [it's a free download]
>
>
> Leonard Chatagnier
> lenc5570 at sbcglobal.net



More information about the kubuntu-users mailing list