This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Bash Script

Old posts that have not been replied to for several years.
Locked
T
The Mad One
Voice
Posts: 15
Joined: Sun Oct 06, 2002 12:31 pm

Bash Script

Post by The Mad One »

I really need help with this bash script and i have NO idea how whats wrong with it let alone how to fix it, its basically a script to start 3 programs in one command so it should be "simple"

Code: Select all

#!/bin/sh
# This is the crontab script for pisg.
#
# Please change the following path to your pisg-directory.

PISG=~/pisg
PEPISG=~/pepisg
STATS=~/psychostats

# the rest should be kept as is

echo "Starting IRC Stats Processing.."
cd $PISG
./pisg --silent
echo "Completed!"
cd ~/

echo "Starting PE IRC Stats Processing.."
cd $PEPISG
./pisg --silent
echo "Completed!"
cd ~/

echo "Starting Server Stats Processing.."
cd $STATS
nice ./stats.pl
echo "All Jobs Completed!"
but when i start it i get this message:

: bad interpreter: No such file or directory

i know its something to do with this "#!/bin/sh" but i dont know what to do with it when i remove it and start this script i just get this junk:
[WeOwn@oracle (~)]$ ./stats
: command not found
: command not found
: command not found
Starting KOD IRC Stats Processing..
: No such file or directory/WeOwn/pisg
./stats: line 14: ./pisg: is a directory
Completed!
: No such file or directory/WeOwn/
: command not found
Starting PE IRC Stats Processing..
: No such file or directory/WeOwn/pepisg
./stats: line 20: ./pisg: is a directory
Completed!
: No such file or directory/WeOwn/
: command not found
Starting KOD Server Stats Processing..
: No such file or directory/WeOwn/psychostats
: No such file or directory
All Jobs Completed!

any help would be apreciated :/
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

It would be helpful to know which shell you are actually running...

for example, it could be

#!/bin/bash (like on debian....) or #!/bin/ksh - the list goes on.

Unfortunately I cant remember how to discover which shell you are actually running... I think there is a command which will show it up, so try searching the web.

[EDIT]

Having reread the topic title, I'm guessing its #!bin/bash
T
The Mad One
Voice
Posts: 15
Joined: Sun Oct 06, 2002 12:31 pm

Post by The Mad One »

I'm with pyroshells and they are running FreeBSD 4.7 stable

but as I said in my first post #!/bin/bash and #!/bin/sh

both give this error:

: bad interpreter: No such file or directory
P
Photon
Op
Posts: 170
Joined: Wed Aug 28, 2002 8:00 am
Location: Liverpool, England

Post by Photon »

Actually you didnt mention that...

I take it you have chmodded it correctly - other than that go into the /bin dir and check to see which shells you have access to..
T
The Mad One
Voice
Posts: 15
Joined: Sun Oct 06, 2002 12:31 pm

Post by The Mad One »

it doesnt look like i have direct access to the bin directory

also heres some things that might help

[WeOwn@oracle (~)]$ echo $SHELL
/usr/local/bin/bash

[WeOwn@oracle (~)]$ whereis sh
sh: /bin/sh /usr/share/man/man1/sh.1.gz

i dont know what else to do :cry:
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

have you tried
#!/usr/local/bin/bash
R
RedAlert
Voice
Posts: 17
Joined: Mon Nov 19, 2001 8:00 pm

Post by RedAlert »

upload your script using ASCII mode with ftp from windows, not BINARY mode.

or run dos2unix on it after uploading.

that will fix all the weird errors.

note that both "cd ~/" commands in the script are unnecessary
m
mihaileonte

Post by mihaileonte »

RedAlert wrote:upload your script using ASCII mode with ftp from windows, not BINARY mode.

or run dos2unix on it after uploading.

that will fix all the weird errors.

note that both "cd ~/" commands in the script are unnecessary
it will not fix weird errors, it will only relpace ODh OAh with 0Ah only because dos has 2 chars for eoln and unix only 1
:lol:
R
RedAlert
Voice
Posts: 17
Joined: Mon Nov 19, 2001 8:00 pm

Post by RedAlert »

Please, get a clue before telling me I'm wrong. Thank you.
User avatar
caesar
Mint Rubber
Posts: 3777
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Write your bash codes in linux not in windows cos it's lame and he is screwing stuff.
Once the game is over, the king and the pawn go back in the same box.
Locked