OESF Portal | OESF Forum | OESF Wiki | LinuxPDA | ELSI (coming soon) | Ibiblio


Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> What's wrong with this executable bash script?
post Mar 10 2004, 09:34 AM
Post #1

Group: Members
Posts: 72
Joined: 2-March 04
Member No.: 2,122

I made up the following script to automate starting up wellenreiter. I am running a C860 using the new Cacko ROM (release 1.20 March 5). I am trying to run the script in Konsole after doing an su - to run as root. The commands all work perfectly if I type them into the Konsole keyboard. I entered the following text into ZEditor and saved the file in the /home/zaurus directory as wellenreiter_startup. I then then did the following to try to make it executable:

cd /home/zaurus
chmod 755 wellenreiter_startup

However, when I try to run it from Konsole (after doing su - and a cd /home/zaurus) I get the following error:

bash: wellenreiter_startup: command not found

Here is the script file:


cd /etc/pcmcia
mv wlan-ng.conf .wlan-ng.conf
mv .hermes.conf hermes.conf
cardctl eject
/etc/rc.d/init.d/pcmcia restart
cardctl insert
cardctl scheme CardResume
cardctl scheme qpewlan0
cardctl reset

OK, so what is wrong here that the script doesn't run. One place I saw that I should also do


But that didn't seem to have any effect. Someone else said I need to use dos2unix to convert the script (that sounds strange to me). Please, linux experts let me know what I did wrong and how to get the script to run. Thanks.
Go to the top of the page
+Quote Post
post Mar 10 2004, 09:47 AM
Post #2

Group: Members
Posts: 12
Joined: 8-February 04
Member No.: 1,757

You either need to put it in a directory listed in your PATH or you need to run it with the complete path to the binary ( /home/zaurus/wellenreiter_startup ) or you need to cd into the same directory as it and run it as ./wellenreiter_startup. Any of these should work. To see what directories are listed in your PATH:

echo $PATH

Just off of the top of my head, /usr/bin seems like an ok place to put it.

Go to the top of the page
+Quote Post
post Mar 10 2004, 09:55 AM
Post #3

Group: Members
Posts: 4,515
Joined: 25-October 03
From: Bath, UK
Member No.: 464

Someone else said I need to use dos2unix to convert the script (that sounds strange to me).

That was me. You only need to do this to strip out the line feeds (if you created the file on a Windows machine or used the Sharp text editor program), otherwise Linux scripts get confused by them.

You must have noticed the converse on a Windows machine if you download a file which was created on a Linux box it all appears on one line with little black squares in between where the line breaks should be - Windows uses CRLF as the end of line whereas Linux uses only CR (I think, though I may have the Linux one wrong).

Go to the top of the page
+Quote Post
post Mar 10 2004, 12:32 PM
Post #4

Group: Members
Posts: 233
Joined: 2-December 03
From: Boston, MA
Member No.: 1,029

Linux and Unix use just LF.
dos2unix strips the CRs.
You can see them in vi, if they're there. They show up as ^M.

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 22nd September 2017 - 12:31 AM