LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-01-2004, 04:29 PM   #1
munna_502
LQ Newbie
 
Registered: Aug 2003
Location: Pakistan
Posts: 29

Rep: Reputation: 15
Lightbulb batch vs ??????


I want to know about the file which can run multiple commands in linux.
In windows we use the batch files which can run multiple dos command
I want to know how we run multiple command by double click
And also want to know the command "pause" which is window dos command.which command is used in linux.
for examlpe i want to compile a java source file In window we write
javac filename.java
pause

but in linux
??????????????????????????????????????????????????????

thanks for reading
 
Old 04-01-2004, 04:39 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
The method to put a number of commands in one file is a 'shell script'. It may use any extension (many people use .sh for scripts written for sh/bash), you need only to make sure it has executable permission set. The file looks this way
Code:
#!/bin/bash
command1
command2
In the script you can use if, for and similar constructions. Details are in 'man bash' (waring: very long).

Which result would you like to have by using pause? Stop after a screen? Then it'd be
command|less
 
Old 04-01-2004, 04:43 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
dos batch is ugly :}

In Linux we have bash-scripting ...

man bash for details.


in addition to what Mara said ...

If you want it to prompt for any kind of
interaction, use
read


Cheers,
Tink
 
Old 04-01-2004, 05:11 PM   #4
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
As for "pause", I think that would be "sleep".
For example, "sleep 2" would cause the script to pause for 2 seconds before continuing to the next command.
 
Old 04-01-2004, 05:13 PM   #5
Pwnz3r
Member
 
Registered: Jan 2004
Location: Lancaster, OH
Distribution: Gentoo
Posts: 393

Rep: Reputation: 30
Darn, you beat me to brining up the sleep command. Well, simply put, shell scripts are much better than batch files because they're... easier? lol
 
Old 04-01-2004, 06:08 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
It's been almost a decade since I wrote my last
batch-file, but I think pause actually waits 'til
you press enter?

Which is why I'd suggest "read something", and
not to evaluate that :)



Cheers,
Tink
 
Old 04-01-2004, 09:42 PM   #7
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
Good point...I don't know anything about bat files, so just suggested what I did know.
There's also "select", which is similar to read, though I can't recall how it's used at the moment....think it has to do with limiting the user to specific input.
 
  


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
Batch Processing ankan Linux - Software 3 10-11-2013 10:52 AM
Batch files spotslayer Linux - Software 3 06-18-2004 07:31 PM
Batch Question hornet74 Linux - General 2 02-02-2004 04:39 PM
batch programming Harpune Programming 1 01-10-2003 09:04 PM
Batch mv and tr script ... OrangeWarp Linux - General 1 12-11-2002 05:14 AM

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

All times are GMT -5. The time now is 11:39 AM.

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