LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-14-2012, 12:36 AM   #1
barathan
LQ Newbie
 
Registered: Jun 2012
Posts: 17

Rep: Reputation: Disabled
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
 
Old 06-14-2012, 01:31 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
http://www.linuxquestions.org/questi...h-file-948293/
 
Old 06-14-2012, 01:54 AM   #3
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
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.

Last edited by Satyaveer Arya; 06-14-2012 at 03:46 AM.
 
Old 06-14-2012, 02:36 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,970

Rep: Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334Reputation: 7334
sorry guy, that is #!/bin/bash
 
Old 06-14-2012, 03:46 AM   #5
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Ohhh, yeah I should make that correct.
 
Old 06-14-2012, 05:47 PM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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.
 
Old 06-14-2012, 05:53 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,364

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you verify my syntax for creating multiple users in a batch file? grayceworks Linux - Newbie 5 03-03-2011 02:04 AM
batch file for accessing a shared file in ubuntu samba pdelcast Linux - Networking 5 04-24-2008 12:21 AM
batch file to convert every file in a directory with mencoder. toben Linux - Software 1 01-31-2008 05:28 PM
How to convert a batch file(.bat) to script file(.sh) manas_sem Programming 4 06-28-2007 12:10 PM
Creating Batch Commands? reefadt Linux - Newbie 3 08-17-2003 09:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration