Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-20-2002, 07:21 PM   #1
LQ Newbie
Registered: Oct 2001
Location: Some hole I dug.
Distribution: Gentoo
Posts: 22

Rep: Reputation: 15
Are linux scripts just as simple as dos batch files?

I just did a new Gentoo installation, and it will take a while to update everything and compile/install X+kde, so I want them both going overnight.

Can I just create a file that says:

emerge world --update
emerge kde

and save it as something like and then run it? Or what else would I have to do?
Old 07-20-2002, 07:50 PM   #2
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2

Rep: Reputation: 34
I am not sure about the commands that you gave. But if they exist and there in your path. you can surely do it. ( I don't find "emerge" in my path. But I use RH7.2 ). You might do chmod u+rx and to run it
from the directory in which it is stored. If you want, create a "bin" directory in your home and add to your path so that later you can put such stuff there and it will be easier to use these scripts later ( This is only optional. Forget it if you don't understand it now )
And about bash script, I should say, I never found the greek or latin in autoexec that enlightening :-) .

Last edited by sarin; 07-20-2002 at 07:51 PM.
Old 07-20-2002, 08:23 PM   #3
Senior Member
Registered: Apr 2001
Location: Plymouth, England.
Distribution: Mostly Debian based systems
Posts: 4,368

Rep: Reputation: 63
Ok, shell scripts (bash/sh/csh/whateversh) are similar in principle to the ol' DOS .bat files, and in many ways, they similar in implementation aswell. The beauty about scripting, though, is that if you should so choose, they can be much more complex, even becoming a complete program!

I'm assuming that the 'emerge' command is a gentoo specific command. If those are the only two commands you will want to use, and you're certain that they will finish fine, then you need not even write a script.

If you have emerge world --update && emerge kde as a single command, then the first will run, and when it has finished, the second will run. I suppose the advantage of having the two commands run from a script is that you could then run the script with ./ & and it wouldn't tie-up your terminal, so you could get on with something else in the mean time.

Hope this helps.
Old 07-21-2002, 12:02 AM   #4
Registered: Jun 2002
Location: N 37 33.327 E 126 55.650
Distribution: Gentoo, Slackware, OpenZaurus
Posts: 186

Rep: Reputation: 30

Well, your script should look something like this

emerge world --update
emerge kde
And then, don't forget to make it executable
chmod +x

Good Luck!

Last edited by RefriedBean; 07-21-2002 at 12:03 AM.
Old 07-21-2002, 11:42 AM   #5
Registered: Apr 2002
Posts: 32

Rep: Reputation: 15
if it is a new gentoo installation, everyting will be up to date. So you probably wont need to update world.
You can also emerge multiple packages in one command, ie

emerge kde mozilla sylpheed waimea

that will probably take care of anything you need that the script was going to do. Be sure to check out all the help gentoo has to offer. They have great help on mailing lists, their forum and the irc channel. check it all out at the gentoo page

Last edited by almostlucky; 07-21-2002 at 11:45 AM.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux batch files denizen Linux - Newbie 3 07-28-2004 03:56 AM
DOS batch equivalent PyroBoy101 Linux - Newbie 5 01-28-2004 08:08 PM
"batch files" in red hat, similar to .bat files in dos shycalais Linux - Newbie 2 10-12-2003 08:34 AM
Writing Scripts or Batch files? Nicksan Linux - Software 1 06-29-2003 11:49 PM
Like MS-DOS batch file but for Linux? rverlander Programming 2 06-23-2002 02:51 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:07 PM.

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