LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-03-2007, 12:06 AM   #1
oldgi
LQ Newbie
 
Registered: Jun 2007
Posts: 4

Rep: Reputation: 0
Question Does linux run bat files like DOS


Just getting started with Linux. Does Linux have a routine/program to run batch files like DOS does with bat files?

My question pertains to making the menu.lst boot to XP first and second to Ubuntu... I got it but I would think a simple two line bat to open it as writable then do the cut and paste for the boot sequence. Finally a one line bat to change menu.lst back to read only.

The reason I am asking is that most patches I see must be run in terminal mode. If these patches could be copy/cut and paste into a (bat) file and run it would be easier than running in terminal mode and doing all that typing and correcting my mistakes when looking back and forth from the information I am typing.
 
Old 07-03-2007, 12:36 AM   #2
wjevans_7d1@yahoo.co
Member
 
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 31
The *nix equivalent of bat files is shell scripts. In Linux, the shell is usually bash, so those would be bash scripts.

Like bat files, bash scripts mimic closely what you'd type on a command line. For an intro to bash, google this:

Code:
bash tutorial
Please do not read what's in the following box:

Quote:
This is obviously an oldie.

Q: What do you get when you cross Lee Iacocca and a vampire?

A: autoexec.bat
Hope this helps. The first part of this, anyway.
 
Old 07-03-2007, 02:59 AM   #3
phidor
Member
 
Registered: Apr 2005
Location: Timaru, New Zealand
Distribution: Manjaro
Posts: 105

Rep: Reputation: 15
If you are only just getting started with Linux, you might be best, at this early stage, not to concentrate on Shell Scripts until you get a bit of a feel for the whole Linux thing. A particularly good book, that will bring you into shell scripting in a logical and timely manner - by giving you the preliminary background you'll need first - is Paul Sheer's "Rute Users Tutorial and Exposition" For a free electronic copy: http://www.linux-books.us/gnoppix_0001.php
When you have studied this excellent book (don't be put off by its age by the way) I suggest you work through a good few wee exercises, as suggested by the author, before trying to do your own little exercise - to get a bit of a feel for the idea of writing and executing scripts. From my experience they are not exactly like DOS bat files because relative to DOS, there are a huge number of very precise and powerful variations in what you can do. Good hunting!

Phidor.
 
Old 07-03-2007, 09:22 AM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
It's perfectly possible to write small scripts to mess around with menu.lst. Rather than manipulate the contents of the file, the easiest thing is to just have a couple versions of the file and copy the desired version to menu.lst. For example, you could have one version which defaults to Windows and another version which defaults to Linux.

However, no bash script will run before Linux is booted up. Grub is a very small bootloader utility program which does NOT include bash. If you want some fancy bootloader logic, then you'll need to customize something more sophisticated than just grub. This isn't really a newbie project.

Anyway, menu.lst is writeable by default, by the root superuser. There's no need to make it read-only.

Personally, I always use the "default saved" option in menu.lst when dual booting. That way, in defaults to booting up the OS which was booted up last time.
 
Old 07-04-2007, 12:03 AM   #5
oldgi
LQ Newbie
 
Registered: Jun 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Hey thanks to all three of you..... what a pleasure to receive such simple but knowledgeable feedback.

I have already started the Rute User's Tutorial and Exposition before I am responding.

Thanks again.

I'll be back
 
Old 07-04-2007, 12:42 AM   #6
rushadrenaline
Member
 
Registered: Nov 2006
Location: Bangalore,New delhi
Distribution: RHEL5, Kubuntu, Mandriva 2008
Posts: 69

Rep: Reputation: 15
Shell scripts are analogous to DOS batch (.bat) files. That is, shell scripts are simply text files (created with any text editor) that contain a series of commands. These commands can be Linux OS commands, commands that run programs, commands that "call" other scripts, or any combination of these. That way you just execute the script every time you want to accomplish a task or process rather than typing in all the commands by hand every time.
(If you're experienced with DOS, you may want to check out www.tldp.org/LDP/abs/html/dosbatch.html for a comparison of DOS-to-Linux batch file statements and shell commands.)
As such, the various shells in Linux are not only a user interfaces but kind of like programming languages as well. The Korn shell is considered the best shell for programming on UNIX systems and the Linux Bash shell incorporates many of the Korn shell's functionality.
 
Old 07-05-2007, 11:47 AM   #7
oldgi
LQ Newbie
 
Registered: Jun 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for the feedback.
 
  


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
how to run DOS EXE file in Debian Linux RMLinux Linux - Newbie 4 08-17-2006 01:25 PM
Linux equivalent of bat files anjanesh Linux - Newbie 19 12-30-2005 12:15 PM
how to run the *.bat file ztdep Linux - Software 8 07-19-2005 04:36 PM
.bat files on Linux? dave1.1 Linux - Newbie 5 10-21-2004 07:15 PM
"batch files" in red hat, similar to .bat files in dos shycalais Linux - Newbie 2 10-12-2003 08:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06: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
Open Source Consulting | Domain Registration