Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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!
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.