LinuxQuestions.org
Review your favorite Linux distribution.
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, 01: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, 02:31 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

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

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 04:46 AM.
 
Old 06-14-2012, 03:36 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,779

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

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Ohhh, yeah I should make that correct.
 
Old 06-14-2012, 06:47 PM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,834

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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, 06:53 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:04 AM
batch file for accessing a shared file in ubuntu samba pdelcast Linux - Networking 5 04-24-2008 01:21 AM
batch file to convert every file in a directory with mencoder. toben Linux - Software 1 01-31-2008 06:28 PM
How to convert a batch file(.bat) to script file(.sh) manas_sem Programming 4 06-28-2007 01:10 PM
Creating Batch Commands? reefadt Linux - Newbie 3 08-17-2003 10:46 AM

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

All times are GMT -5. The time now is 11:05 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration