On Tuesday 05 February 2002 21:10, Harry G wrote:
OK. Now for a really dumb question.
never... we have all started with DOS, I guess... :)
Do I write the scripts in an editor, or from the command line or what?
well, after all you need your script in some kind of file... wouldn't make sense to write it new each time... :) ...so I'd use an editor... you could actually do it from the commandline, but that would be very tedious work...
In DOS, you used an editor and named it with an .bat extension. I would suspect you would do some sort of chmod ??? filename, then run it with a ./file.sh?
Linux doesn't care about file extensions, so you could name it as you'd like, but the first line in the file should be (for a shell-script) #!/bin/sh it tells the system what interpreter to use... it'll run w/o that, I think... when you're done, you make the script executable (e.g. if you want it to be usable by everybody: chmod ugo+x filename) you can then run it as you suggested, but you might also copy it to /usr/bin or some other dir in the path and be able to use it like any other command... besides that, they really work like batch-files... just put commands in them and they'll be executed after another... but those scripts are a lot more powerful... you can program loops and if-clauses, you can even construct graphical menus... Hansen
Harry G
On Tuesday February 05 2002 02:12 pm, you interfaced in analog form:
On Tuesday 05 February 2002 19:59, Harry G wrote:
I want to write the equivalent of DOS batch files for simplifying backups using tar, and doing a few other things. How is this done in Linux using
check out the Advanced Bash Scripting HowTo, probably located here (on a standard SuSE installation: /usr/share/doc/howto/en/html/Adv-Bash-Scr-HOWTO
those shellscripts are a very easy way to getting stuff done automagically... but they're pretty powerful as well...
Hansen
-- Powered by SuSE 7.3 - Linux 2.4.10-4GB KDE 2.2.1 - KMail 1.3.1