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.
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
??????????????????????????????????????????????????????
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
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.