PDA

View Full Version : Scripting


Han_Solo
03-31-2002, 08:26 AM
I've read the above but I can't get my script to work.

I actually want to write a script that will connect to s database via ssh and do a sql dump.

However as I'm still getting my feet wet, I thought I'd try something simple first.

#!/bin/sh

echo "This script is executing"


########


unfortunately, whenever I run the

% runscript

I get

runscript: Command not found.



I've done the rehash, chmod etc. But it still doesn't work...

Any help is welcome.

Han_Solo

PS: I'm saving up for OS X Unleashed....

didde
03-31-2002, 09:33 AM
I'm sure you're trying to start the script like this:

"sh yourScript.sh"

.. if not, give it a try.

Titanium Man
03-31-2002, 10:15 PM
I'm new to scripting too, but is your script in your path? If you do this:

echo $path

or

echo $PATH

(depending on your shell) you'll get a list of places the script can be put for it to be recognized. Or you could just execute your script thusly:

./runscript

if you're in the same directory as your script. Let us know how things work out. :D

Han_Solo
04-01-2002, 12:08 AM
Don't know what I did, but it did work...


Thanks

chug
04-01-2002, 09:43 AM
Make a dir called bin in your users dir and then mv the script into that dir. You can then type the name of your script as if it was a command.

Make sure you check to see if there are any other commands with the same name. if so, change it to something that is not in use.

So if you call it comp.. type comp and then <tab> to see what other commands are around with the name comp. If so, add some more compmail <tab> and see if that is free.. And so on untill you have something that works.

:)