LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-28-2007, 06:52 AM   #1
manas_sem
LQ Newbie
 
Registered: Dec 2006
Posts: 29

Rep: Reputation: 15
How to convert a batch file(.bat) to script file(.sh)


hi,

How to convert a batch file(.bat) to script file(.sh)..

Thanx
 
Old 06-28-2007, 06:55 AM   #2
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
You don't.
Instead, you think what you want to achieve and then write a script for it.
 
Old 06-28-2007, 06:56 AM   #3
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Manually or automatically?

Manually it's rather easy so automating the task shouldn't be a problem..just turn those exec or start lines into bash equivalents (if you're going to run it in bash), \ to / and so on..oh, and notice that capitals do make difference. There are some summaries on the net about Linux<->DOS command equivalencies, using them it should be easy.

After it's done,
Code:
chmod +x batchfile.sh
and you're ready to go.
 
Old 06-28-2007, 06:59 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
You may want to read the relevant parts of this: http://rute.2038bug.com/index.html.gz ,
also this: http://tldp.org/LDP/abs/html/
 
Old 06-28-2007, 12:10 PM   #5
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Simon Bridge is absolutely right: "You don't". You need to take whatever you were doing in the .bat file, and completely re-write it to do the equivalent in Linux.

In order to do this (as b0uncer and chrism01 both pointed out), you need to know two things:

a) Some basic "shell script" syntax (for example, "bash" or "sh" syntax)
b) Some basic Linux commands (for example, "ls", "cat", ..., "awk", "sed", ...)

Here (in addition to the links already cited) is another beginner's tutorial that might help :

http://www.cyberciti.biz/nixcraft/li...features/lsst/
 
  


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
How to run bat file from Unix script??? gopi_20us Programming 10 09-14-2010 09:15 AM
i want to convert .wav file into mp3 files in batch mode sparsh Linux - Software 6 11-20-2007 10:53 AM
convert .bat / .csh file to .sh files massoo Programming 1 03-06-2006 06:10 PM
Remote Win Bat File execute Shell Script on AIX Server DriveMeCrazy AIX 5 05-26-2004 06:24 PM
Need help writing a batch/script file cbjhawks Linux - General 1 01-28-2004 05:54 PM


All times are GMT -5. The time now is 10:47 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration