Sponsored Content
Top Forums Shell Programming and Scripting Running multiple unix commands in a single script Post 302393589 by vikas898 on Tuesday 9th of February 2010 07:12:26 AM
Old 02-09-2010
Quote:
Originally Posted by koti_rama
Hi,

I would like to write a script with include more than 6 unix commands.

my script like below:
Code:
echo " script started"
 
ls -ld 
 
bdf | grep "rama"
 
tail -10 log.txt
...
..
...

now, i want to run above unix commands one by one.
example:
first the ls -ld command will be executed, then the script will wait for user input( ENTER from KEYBOARD) to continue for execute next command(bdf | grep "rama")


After each command, give one more command as "read".
So it will wait for ur enter.


eg.
Code:
echo " script started"
 read;
ls -ld 
 read;
bdf | grep "rama"
 read;
tail -10 log.txt
read;


Last edited by Scott; 02-09-2010 at 09:39 AM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Problem running plsql & unix commands in 1 script

Hi, I need help again. When I run this shell script, it only runs the unld_date.sql piece and exits. How can I structure this to run all the way to the end? When I don't have the unld_date.sql piece in here, everything runs fine from the date compare piece all the way to the end. Thanks in... (5 Replies)
Discussion started by: siog
5 Replies

2. UNIX for Dummies Questions & Answers

running a simple script file with multiple commands

I'm trying to run a script file with multiple commands that I would normally type into the command line. The commands are: #!/bin/bash diff Test1.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1.o0 > differences2 diff Test1a.o0 /usr3/ronelso4/Desktop/verificationKPC/Test1a.o0 >> differences2... (1 Reply)
Discussion started by: knelson
1 Replies

3. HP-UX

Automatic execution of commands in multiple servers using single script.

Hi, I've to do a simple job many times whenever it has been asked, just i've to log in to all of fourtien HP servers and i've to execute ps -fu user > temp cat temp|sendmail "xyz@z.com" commands to send the statics of all of 14 servers over the mail to particular user id.. Though logging... (4 Replies)
Discussion started by: vickramshetty
4 Replies

4. Shell Programming and Scripting

Running unix commands in a perl script

Executing two unix commads via perl script one after another e.g: make clean bsub -i -q short make have tried using exec but the second command doesnt executes (1 Reply)
Discussion started by: rajroshan
1 Replies

5. Programming

Running Multiple Unix commands in qx

Hi All, Is there anything wrong with below syntax? qx {perldoc -v ModuleName.pm | grep -i Description } BTW, this question is related to Perl. Thanks. (3 Replies)
Discussion started by: jal_capri
3 Replies

6. Shell Programming and Scripting

Converting Multiple rows to Single Row using unix commands

Can somebody help me in solving this.. Input data is like 0 A 1 B 2 C 3 D 0 A1 1 B1 2 C1 3 D1 0 A2 1 B2 2 C2 3 D2 Output should be like A B C D A1 B1 C1 D1 A2 B2 C2 D2 (7 Replies)
Discussion started by: Mahantesh Patil
7 Replies

7. UNIX for Dummies Questions & Answers

Multiple Commands on a Single Line

Hi There, I have a cronjob that executes a small script (few lines) that I am certain can be achieved in a single line. The functional objective is actually really simple; cmd var1 The '1' in 'var1' is actually derived from date (day of month) but the snag is when working with 1-9 I... (3 Replies)
Discussion started by: Random79
3 Replies

8. Shell Programming and Scripting

Create a UNIX script file with multiple commands

Hi Good morning all, I want to create script file with multiple commands. For ex: pmrep connect is one of the command to connect to repository. pmrep objectexport is another command to export objects to a file. These commands should run sequentially.But when i try to execute this, the first... (4 Replies)
Discussion started by: SekhaReddy
4 Replies

9. Shell Programming and Scripting

Perl script running multiple commands at once

Hi All, I have put a perl script together to go and collect some information from multiple nodes/endpoints. The script works absolutly fine however I want to make it quicker. You will see in the below that my script calls an expect script called ssh_run_cmd2.exp followed by the IP of... (7 Replies)
Discussion started by: mutley2202
7 Replies

10. Shell Programming and Scripting

Check status of long running multiple curl commands in shell script

I am working on script. it reads a file which contains multiple lines Ex; curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=1 curl --write-out %{http_code} --silent --output /dev/null http://hostname:port/input=2 curl --write-out %{http_code} --silent ... (2 Replies)
Discussion started by: oraclermanpt
2 Replies
escape(1)							Mail Avenger 0.8.3							 escape(1)

NAME
escape - escape shell special characters in a string SYNOPSIS
escape string DESCRIPTION
escape prepends a "" character to all shell special characters in string, making it safe to compose a shell command with the result. EXAMPLES
The following is a contrived example showing how one can unintentionally end up executing the contents of a string: $ var='; echo gotcha!' $ eval echo hi $var hi gotcha! $ Using escape, one can avoid executing the contents of $var: $ eval echo hi `escape "$var"` hi ; echo gotcha! $ A less contrived example is passing arguments to Mail Avenger bodytest commands containing possibly unsafe environment variables. For example, you might write a hypothetical reject_bcc script to reject mail not explicitly addressed to the recipient: #!/bin/sh formail -x to -x cc -x resent-to -x resent-cc | fgrep "$1" > /dev/null && exit 0 echo "<$1>.. address does not accept blind carbon copies" exit 100 To invoke this script, passing it the recipient address as an argument, you would need to put the following in your Mail Avenger rcpt script: bodytest reject_bcc `escape "$RECIPIENT"` SEE ALSO
avenger(1), The Mail Avenger home page: <http://www.mailavenger.org/>. BUGS
escape is designed for the Bourne shell, which is what Mail Avenger scripts use. escape might or might not work with other shells. AUTHOR
David Mazieres Mail Avenger 0.8.3 2012-04-05 escape(1)
All times are GMT -4. The time now is 05:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy