ldavis at shellworld.net
Sat Nov 8 15:14:38 EST 2003
Okay, from start to middle:
A script is just a text file.
It can have any name. Remember, in Unix, extensions don't matter.
You must make it executable, with:
chmod 700 filename
In the file, the first line should be something like:
(Pound, bang, "/bin/bash")
Now, to answer your question: all variables are handled with dollar signs,
whereas in DOS they were percent signs.
So let's say you wanted a script that would delete the first file and the
second one, and then run nano on the second.
# Deleting the files
echo -n "deleting $1... "
echo -n "Deleting the second file ($2)..."
Note, that the "exit 0" is not necessary. It is just a way to end a
script early, and if you learn more about scripting later, you will find
more creative uses for it.
You may find it useful to read the bash manual page, several times, and
On Sat, 8 Nov 2003, Rejean Proulx wrote:
> I have a bunch of MYSQL tables and files to back up. I want to write some
> scripts that call functions so that I can reuse them. I need to have a
> script that gets called like this
> backsql tablename weekly
> Table name and weekly are 2 parameters. In dos we use to code that with %1
> %2 or maybe it was just numbers. How do I pass parameters to a script? I
> need a sample to work from so I can get started. Then I can read manuals.
> What file names do I use in Linux. Would it be backmysql.sh or something
> like that?
> Rejean Proulx
> Visit my family at http://interfree.ca
> MSN is: rejp at rogers.com
> Ham License VA3REJ
> Speakup mailing list
> Speakup at braille.uwo.ca
More information about the Speakup