Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Shell Script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Shell Script
Authored by: THEM on Jun 19, '02 03:30:40AM

To create a shell script create a new text document in TextEdit, it must be text or it wont work.

Copy and paste the code into the text docuemnt and save it.

Create a folder called bin in your Home. Move the shell script into there.

To add the file to your cron download the program CronniX rom this url:

It's a nicely done program with clear documentation.

[ Reply to This | # ]
chmod is missing
Authored by: k2r on Jun 19, '02 10:23:55AM

you will have to change the mode of the file to "executable", which is done best by issuing
chmod 755 filename_with_extension_if_any
at the commandline.

Otherwise the shell will not execute your script. The suggested mode means:
owner can read, write and execute, groupmembers and others can execute and read the file but not change it.

Some words for the unix-challanged :-)
A shell is the programm you can interact with when opening the terminal. It usually provides access to builtin commands and to commands that are individual programs.
A shell-script is just a plain textfile containing commands that can be executed by the shell, in fact, if you enter all the lines in the textfile by hand on the commandline the shell would execute them, too.
However, reocurring tasks should be automated by creating a script, that can be used like any other command once you have changed the file-permissions to executable.

You might wonder what the first line #!/something/somethingelse means.
It just tells which shell to use for executing the script. Since there are a lot of shells (bash/tcsh/sh) and scripting languages (PERL,Python) around you can write your script in any of them and just tell #!/where/it/is in the first line.

And cron is just a common way to execute commands at specific times. You can tell the system (specifically the cron-deamon) to execute a command every 30 minutes or every Friday at 1500. ChronniX is a convenient tool to use cron without touching the evil commandline.

I apologize for any confusion I have caused,

[ Reply to This | # ]