Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


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

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


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

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

Rep: Reputation: 198Reputation: 198
You don't.
Instead, you think what you want to achieve and then write a script for it.
Old 06-28-2007, 07:56 AM   #3
LQ 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,
chmod +x
and you're ready to go.
Old 06-28-2007, 07:59 AM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,828

Rep: Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559Reputation: 2559
You may want to read the relevant parts of this: ,
also this:
Old 06-28-2007, 01:10 PM   #5
LQ 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 :


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

All times are GMT -5. The time now is 02:52 AM.

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