LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   creating a batch file (https://www.linuxquestions.org/questions/linux-newbie-8/creating-a-batch-file-4175411355/)

barathan 06-14-2012 01:36 AM

creating a batch file
 
Hi friends,

I'm a newbie in LINUX OS. need some help here. i am figuring out of a way to create a batch file in LINUX just like how i did in windows. i want to run two python scripts whenever i run this batch file.

Thanks,
Barathan.R

TobiSGD 06-14-2012 02:31 AM

http://www.linuxquestions.org/questi...h-file-948293/

Satyaveer Arya 06-14-2012 02:54 AM

There is no batch file in linux. You have to use any editor like vim or gedit, anyone and start with the first line using-
#!/bin/bash
and then you can write in the file. Give the file executable permission and then you can execute the file.
And this is what we call shell scripting. If you want the script to run at booting time you can put the file in /etc/rc.local/ directory.

pan64 06-14-2012 03:36 AM

sorry guy, that is #!/bin/bash

Satyaveer Arya 06-14-2012 04:46 AM

Ohhh, yeah I should make that correct. :)

David the H. 06-14-2012 06:47 PM

The *nix shell scripting languages are much more powerful than simple batch files. They take longer to learn, but allow you to do more, more easily, once learned.


Here are a few useful bash scripting references:

http://mywiki.wooledge.org/BashGuide
http://mywiki.wooledge.org/BashFAQ
http://mywiki.wooledge.org/BashPitfalls
http://wiki.bash-hackers.org/scripting/newbie_traps
http://www.linuxcommand.org/index.php
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/index.html
http://www.gnu.org/software/bash/manual/bashref.html
http://wiki.bash-hackers.org/start
http://ss64.com/bash/

Start with the BashGuide, or perhaps linuxcommand.org if you want a hands-on walk-through example. They should give you the basics you need to know.

chrism01 06-14-2012 06:53 PM

If you want it to run automatically at certain times, you'll need to add it (the bash script) into cron http://www.adminschoice.com/crontab-quick-reference


All times are GMT -5. The time now is 03:41 AM.