LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux batch files (https://www.linuxquestions.org/questions/linux-newbie-8/linux-batch-files-210447/)

denizen 07-27-2004 10:18 PM

Linux batch files
 
Anyone who is familiar with dos should be familiar with the old batch files.Simple programs created to execute a string of command line commands.My question is this, is there anyway I can create something like a dos batch file in linux?

If so what do I need to do it, and how do I do it.

frob23 07-27-2004 10:20 PM

It is called a shell script

Just start it with
#!/bin/sh (or whatever shell the commands are for)
type all the commands below it


And chmod +x the_filename.

There... same exact thing.

EDIT: Well not exactly the same thing... these are hundreds of times more powerful and you can program whole programs with them. But in their simplest form... they are exactly like batch files.

denizen 07-27-2004 10:34 PM

Thank you very much.

Yeah, I know batch files can't do a lot but are quite handy.I'll have to look into these shell scripts.

wijnands 07-28-2004 03:56 AM

and something else I once searched myself silly for. Quite often you'll need to execute your script by typing ./scriptname


All times are GMT -5. The time now is 04:18 AM.