Bash Scripts-HowTo

Leonard Chatagnier lenc5570 at sbcglobal.net
Tue Sep 12 07:25:57 UTC 2006



>
> It may be stupid of me, but I have to ask. Did you
> set the executable
> bit for the script file?
> 
> - Billy
> 
Hello billy,
Nobody using Linux is stupid, not you, not me, but a
lot like me are very unknowledgeable and new to the
OS.
I checked a few of the script file I wanted to run and
they were all executable(3-x's). Btw, these are all
Kubuntu script files and I did discover that there are
both .sh and bash script files. Was only aware of the
.sh kind til now so maybe I improved my knowlege just
a bit. Since these are all Kubuntu executable conf and
setup files, I would expect them to have the proper
perms and wouldn't have thought to check without your
input.  Thanks.
> On 9/10/06, Leonard Chatagnier
> <lenc5570 at sbcglobal.net> wrote:
> >
> > > > > 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]
> >
> > Hello Grumpy Penguin. I really would like to check
> out
> > the download book. However, I think you forget to
> add
> > the link. Also, the title of the book would be
> nice to
> > have. Thanks.
> >
> > > >
> > > >
> > > > Leonard Chatagnier
> > > > lenc5570 at sbcglobal.net
> > >
> >
> > Leonard Chatagnier
> > lenc5570 at sbcglobal.net
> >
> > --
> > kubuntu-users mailing list
> > kubuntu-users at lists.ubuntu.com
> >
>
https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> >
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 11 Sep 2006 08:28:32 -0500
> From: Tom Coffin <coffindvm at sbcglobal.net>
> Subject: archive's connection fails
> To: kubuntu-users at lists.ubuntu.com
> Message-ID: <20060911132832.GB991 at localhost>
> Content-Type: text/plain; charset=us-ascii
> 
> I have two kubuntu installs one on a dsl connection
> works fine. The other
> is via wireless ISP.  On the wireless one when try
> to update the sources
> list I get this error:
> Err http:us.archive.ubuntu.com dapper Release.gpg
>   Connection failed [IP: 146.137.96.7 80]
> The error repeats for all the source sites.
> 
> My sources.list is correct apt-get,aptitude, and
> adept all give same
> error.  I can surf the internet.
> 
> Need help with solution to connection problem. If
> more information is
> needed will gladly supply it.
> 
> Tom
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Mon, 11 Sep 2006 08:57:51 -0500
> From: "Roshan Mansinghani" <rosh1182 at gmail.com>
> Subject: Re: archive's connection fails
> To: "Kubuntu Help and User Discussions"
> 	<kubuntu-users at lists.ubuntu.com>
> Message-ID:
> 
>
<b78d645d0609110657w576d410ci4d14e127fe29787b at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Tom,
> 
> Are you sure your wireless connection actually
> works?  A great way to check
> is to type:
> 
> ping www.google.com
> 
> in the command line.  If you are not connected, it
> will just sit there and
> do nothing.  If you are, you should start seeing
> some output pretty
> quickly.  Let it sit there for about a minute or so
> if you don't see
> anything.  Please post the output of that command as
> well as:
> 
> ifconfig
> 
> On 9/11/06, Tom Coffin <coffindvm at sbcglobal.net>
> wrote:
> >
> > I have two kubuntu installs one on a dsl
> connection works fine. The other
> > is via wireless ISP.  On the wireless one when try
> to update the sources
> > list I get this error:
> > Err http:us.archive.ubuntu.com dapper Release.gpg
> >   Connection failed [IP: 146.137.96.7 80]
> > The error repeats for all the source sites.
> >
> > My sources.list is correct apt-get,aptitude, and
> adept all give same
> > error.  I can surf the internet.
> >
> > Need help with solution to connection problem. If
> more information is
> > needed will gladly supply it.
> >
> > Tom
> >
> > --
> > kubuntu-users mailing list
> > kubuntu-users at lists.ubuntu.com
> >
>
https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
https://lists.ubuntu.com/archives/kubuntu-users/attachments/20060911/c0e07ff6/attachment-0001.htm
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Mon, 11 Sep 2006 09:12:34 -0500
> From: Larry Alkoff <labradley at mindspring.com>
> Subject: Re: Why aren't my etc/cron.daily scripts
> running?
> To: Kubuntu Help and User Discussions
> <kubuntu-users at lists.ubuntu.com>
> Message-ID: <45056ED2.1080200 at mindspring.com>
> Content-Type: text/plain; charset=ISO-8859-1;
> format=flowed
> 
> Gene Heskett wrote:
> > On Monday 11 September 2006 00:59, Larry Alkoff
> wrote:
> >> Using Kubuntu 6.06.
> >> My scripts in /etc/cron.daily are not running.
> >>
> >> What program makes them run?
> >>
> >> Larry
> >>
> > The obvious question:  Is cron actually running?
> > gene at shop:~$ ps -ea|grep cron
> > should get you something like this:
> >  4154 ?        00:00:00 cron
> > 
> >> --
> >> Larry Alkoff N2LA - Austin TX
> >> Using Thunderbird on Linux
> > 
> 
> Sorry I should have put that in the original post.
> Yes, cron is running per ps al.
> 
> Larry
> 
> -- 
> Larry Alkoff N2LA - Austin TX
> Using Thunderbird on Linux
> 
> 
> 
> ------------------------------
> 
> Message: 5
> Date: Mon, 11 Sep 2006 09:33:03 -0500
> From: Tom Coffin <coffindvm at sbcglobal.net>
> Subject: Re: archive's connection fails
> To: Kubuntu Help and User Discussions
> <kubuntu-users at lists.ubuntu.com>
> Message-ID: <20060911143303.GC991 at localhost>
> Content-Type: text/plain; charset=us-ascii
> 
> On Mon, Sep 11, 2006 at 08:57:51AM -0500, Roshan
> Mansinghani wrote:
> 
> Thanks for reply Roshan,  The connection works, surf
> internet without
> problems.  
> 
> ifconfig details will come from my memory as the
> computer in question is
> at home.  There is a static IP address, default
> gateway and two DNS
> server addresses. The error occurs if I leave the
> DNS numbers in the
> config or remove them it makes no difference.  I got
> the numbers
> from the network config in windows xp which the tech
> from the ISP set
> up.  The hardware consists of a waverider EUM 3005
> wireless modem which
> connects to a outside yagi antenna operating in the
> 900 mhz frequency
> range.  www.waverider.com makes the modem.
> 
> > Tom,
> > 
> > Are you sure your wireless connection actually
> works?  A great way to check
> > is to type:
> > 
> > ping www.google.com
> > 
> > in the command line.  If you are not connected, it
> will just sit there and
> > do nothing.  If you are, you should start seeing
> some output pretty
> > quickly.  Let it sit there for about a minute or
> so if you don't see
> > anything.  Please post the output of that command
> as well as:
> > 
> > ifconfig
> > 
> > On 9/11/06, Tom Coffin <coffindvm at sbcglobal.net>
> wrote:
> > >
> > >I have two kubuntu installs one on a dsl
> connection works fine. The other
> > >is via wireless ISP.  On the wireless one when
> try to update the sources
> > >list I get this error:
> > >Err http:us.archive.ubuntu.com dapper Release.gpg
> > >  Connection failed [IP: 146.137.96.7 80]
> > >The error repeats for all the source sites.
> > >
> > >My sources.list is correct apt-get,aptitude, and
> adept all give same
> > >error.  I can surf the internet.
> > >
> > >Need help with solution to connection problem. If
> more information is
> > >needed will gladly supply it.
> > >
> > >Tom
> > >
> > >--
> > >kubuntu-users mailing list
> > >kubuntu-users at lists.ubuntu.com
> >
>
>https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> > >
> 
> > -- 
> > kubuntu-users mailing list
> > kubuntu-users at lists.ubuntu.com
> >
>
https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> 
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Mon, 11 Sep 2006 08:08:46 -0700
> From: "Grumpy_Penguin" <grumpypenguin at qwest.net>
> Subject: Re: Bash Scripts-HowTo
> To: "Kubuntu Help and User Discussions"
> 	<kubuntu-users at lists.ubuntu.com>
> Message-ID:
> <200609110808.46339.grumpypenguin at qwest.net>
> Content-Type: text/plain;  charset="iso-8859-1"
> 
> On Monday 11 September 2006 04:52 am, Billy
> Pollifrone wrote:
> > It may be stupid of me, but I have to ask. Did you
> set the executable
> > bit for the script file?
> >
> > - Billy
> >
> > On 9/10/06, Leonard Chatagnier
> <lenc5570 at sbcglobal.net> wrote:
> > > > > > 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]
> > >
> > > Hello Grumpy Penguin. I really would like to
> check out
> > > the download book. However, I think you forget
> to add
> > > the link. Also, the title of the book would be
> nice to
> > > have. Thanks.
> The title is Rute
> also known as the root users tutorial exposition
> http://rute.2038bug.com/index.html.gz
> just select what type of download you want or read
> it online
> [me I bought a dead tree copy]
> > >
> > > > > Leonard Chatagnier
> > > > > lenc5570 at sbcglobal.net
> > >
> > > Leonard Chatagnier
> > > lenc5570 at sbcglobal.net
> > >
> > > --
> > > kubuntu-users mailing list
> > > kubuntu-users at lists.ubuntu.com
> > >
>
https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> 
> 
> 
> ------------------------------
> 
> Message: 7
> Date: Mon, 11 Sep 2006 14:02:18 -0400
> From: Richard <cms01 at tampabay.rr.com>
> Subject: Re: Very ODD, Adept update icon ? NO
> Update, Broken ?
> To: Kubuntu Help and User Discussions
> <kubuntu-users at lists.ubuntu.com>
> Message-ID:
> <200609111402.18819.cms01 at tampabay.rr.com>
> Content-Type: text/plain;  charset="iso-8859-1"
> 
> Scott,
> did what you ask:
> here are the results:
> 
> Sudo apt-get install amarok amarok-xine
> Reading.....
> 
> Some packages could not be installed
> 
> The following packages have unmet dependencie's
> Amarok: depends libvisual-0.4.0 (>=0.4.0)
> "but it is not installable"
> E: Broken package
> -------------------------------------------------
> Okay, there appears to be a real problem
> I can't even use the package manager to remove
> amarok either...
> 
> 
> await the next step.
> Thanks -
> Rich
> 
> 
> On Sunday 10 September 2006 10:04 pm, Scott
> Kitterman wrote:
> > On Sunday 10 September 2006 21:14, Richard wrote:
> > > NOPE: The Same problem still there, its very
> odd,
> > > did see in the CLI that it said about the the
> Keys again,
> > > AND that amarok and amarok plugin (i think) was
> held back.
> > >
> > > And Yes, it download allot of item, but shown
> the key error,
> > > and the amarok updates held back.....
> > >
> > > Do I need to wipe out the computer and do
> another install ?
> > >
> > No.
> > 
> > What I'd do is wait a day or two on the key error
> as Ron Morse said.
> > 
> > For amarok, etc. do this:
> > 
> > sudo apt-get upgrade
> > 
> > You will get the error listing the packages held
> back.  Then:
> > 
> > sudo apt-get install [list the exact package names
> here]
> > 
> > It will then ask you if it's OK to upgrade those
> packages and install some 
> > other new ones.  Say yes.  That should do it.  If
> not, report back and we'll 
> > try again.
> > 
> > Scott K
> > 
> > -- 
> > kubuntu-users mailing list
> > kubuntu-users at lists.ubuntu.com
> >
>
https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> > 
> 
> 
> 
> ------------------------------
> 
> Message: 8
> Date: Mon, 11 Sep 2006 21:06:02 +0200
> From: "Koen" <trudiekoen at telkomsa.net>
> Subject: ADSL FREEZES KUBUNTU
> To: <kubuntu-users at lists.ubuntu.com>
> Message-ID:
>
<KHEFILLHIJNANBBOLGGFMEKFCFAA.trudiekoen at telkomsa.net>
> Content-Type: text/plain;	charset="iso-8859-1"
> 
> I got 1 machine(wifes pc)running on Xp with a 512
> ADSL line with no problems
> and easy to config. My Pc running Kubuntu constantly
> gets problems. I
> installed my settings "sudo pppoeconf"
> and in system settings @ the network settings I
> typed in my Primary and
> secondary DNS servers. I got 2 pc's connected to my
> adsl hub using Ethernet
> although this is also an a wifi hub.
> If I surf for 5 minutes Kubuntu freezes so badly
> that I have to Reset as
> nothing else works.
> Somebody out there got the same problem and how was
> it resolved. Where else
> can I config my pppoE
> I also "sudo pon dsl-provider". The hub is a ADSL
> 5102G with 4 ports and
> Wifi.
> Explain in Newbie language
> 
> 
> 
> 
> 
> ------------------------------
> 
> Message: 9
> Date: Mon, 11 Sep 2006 14:33:05 -0500
> From: Tom Coffin <coffindvm at sbcglobal.net>
> Subject: Re: archive's connection fails
> To: Kubuntu Help and User Discussions
> <kubuntu-users at lists.ubuntu.com>
> Message-ID: <20060911193305.GD991 at localhost>
> Content-Type: text/plain; charset=us-ascii
> 
> On Mon, Sep 11, 2006 at 08:57:51AM -0500, Roshan
> Mansinghani wrote:
> Here is output from ifconfig:
> 
> etho   Link encap:Ethernet  HWaddr 00:15:F2:3F:2D:32
>        inet addr:10.3.85.111 Bcast:10.3.85.255 
> Mask:255.255.255.0
>        inet6 addr: fe80::215:f2ff:fe3f:2d32/64
> Scope:Link
>        UP BROADCAST RUNNING MULTICAST MTU:1500
> Metric:1
>        RX packets:353 errprs:0 dropped:0 overruns:0
> frame:0
>        TX packets:349 errors:0 dropped:0 overruns:0
> carrier:0
>        RX bytes:79968 (78.0 KiB) /tx bytes:44751
> (43.7 KiB)
> 
> lo     Link encap:Local Loopback
>        inet addr:127.0.0.1 Mask:255.0.0.0
>        inet6 addr: ::1/128 Scope:Host
>        UP LOOPBACK RUNNING MTU:16436 Metric:1
>        RX packets:3 errors:0 droppped:0 overruns:0
> frame:0
>        Tx packkets:3 errors:0 dropped:0 overruns:0
> carrier:0
>        collisioons:0 txqueuelen:0
>        Rx bytes:172 (172.0 b) TX bytes:172 (172.0 b)
> 
> 
> > Tom,
> > 
> > Are you sure your wireless connection actually
> works?  A great way to check
> > is to type:
> > 
> > ping www.google.com
> > 
> > in the command line.  If you are not connected, it
> will just sit there and
> > do nothing.  If you are, you should start seeing
> some output pretty
> > quickly.  Let it sit there for about a minute or
> so if you don't see
> > anything.  Please post the output of that command
> as well as:
> > 
> > ifconfig
> > 
> > On 9/11/06, Tom Coffin <coffindvm at sbcglobal.net>
> wrote:
> > >
> > >I have two kubuntu installs one on a dsl
> connection works fine. The other
> > >is via wireless ISP.  On the wireless one when
> try to update the sources
> > >list I get this error:
> > >Err http:us.archive.ubuntu.com dapper Release.gpg
> > >  Connection failed [IP: 146.137.96.7 80]
> > >The error repeats for all the source sites.
> > >
> > >My sources.list is correct apt-get,aptitude, and
> adept all give same
> > >error.  I can surf the internet.
> > >
> > >Need help with solution to connection problem. If
> more information is
> > >needed will gladly supply it.
> > >
> > >Tom
> > >
> > >--
> > >kubuntu-users mailing list
> > >kubuntu-users at lists.ubuntu.com
> >
>
>https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> > >
> 
> > -- 
> > kubuntu-users mailing list
> > kubuntu-users at lists.ubuntu.com
> >
>
https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> 
> 
> 
> 
> ------------------------------
> 
> -- 
> kubuntu-users mailing list
> kubuntu-users at lists.ubuntu.com
>
https://lists.ubuntu.com/mailman/listinfo/kubuntu-users
> 
> 
> End of kubuntu-users Digest, Vol 20, Issue 35
> *********************************************
> 


Leonard Chatagnier
lenc5570 at sbcglobal.net




More information about the kubuntu-users mailing list