multiple commands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting multiple commands
# 1  
Old 01-19-2011
multiple commands

Hi,

I have multiple commands that i need to run daily on my Solaris servers and watch the output, and actually i do it as multi-tasking. I do not want to put all of them in the file, and run it, and get the entire output at one time.

What i want is that it should ask for before it runs next command.

What is the best way to accomplish it. Could some help me on this?

Thanks, John,
# 2  
Old 01-19-2011
prompt for input

See this example on prompting for input
https://www.unix.com/shell-programmin...-one-line.html
# 3  
Old 01-19-2011
Thanks for prompt response. I know how to read an input, my question is how to prompt next command to run.
# 4  
Old 01-19-2011
You mean like the pause command in windows batch files?

Check Howto add pause prompt in a shell script ( bash pause command )
This User Gave Thanks to simusphere For This Post:
# 5  
Old 01-19-2011
Feel free to replace the echo $LINENO by your task1 task2 task3 ...

Code:
 # cat -n mtst
     1  ask(){
     2       echo "Do you want to continue y/[n]?"
     3       read a
     4       case $a in
     5            Y|y|yes|YES) RC=0 ;;
     6            *) RC=1 ;;
     7       esac
     8       return ${RC}
     9  }
    10
    11  echo $LINENO
    12  ask || exit $?
    13  echo $LINENO
    14  ask || exit $?
    15  echo $LINENO
    16  ask || exit $?
    17  echo $LINENO
    18  ask || exit $?
    19  echo $LINENO
    20  exit $?
# ksh mtst
11
Do you want to continue y/[n]?
y
13
Do you want to continue y/[n]?
y
15
Do you want to continue y/[n]?
n
#


Last edited by ctsgnb; 01-19-2011 at 11:34 AM.. Reason: indentation
This User Gave Thanks to ctsgnb For This Post:
# 6  
Old 01-19-2011
Yes, this is what i wanted.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Pass Multiple Commands and Open Multiple Xterms via PSS

Hello, I'm attempting to open multiple xterms and run a command as an SAP user via sudo using PSSH. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in to the servers in the file list, and SUDO to the SAP(ADM) user, but it won't do anything else... (11 Replies)
Discussion started by: icemanj
11 Replies

2. Shell Programming and Scripting

Multiple Commands in PS

I need to find in file where the record starts with "A,U,I,R" and their file name Record will look like below A|1|138||XXXX|XX|XX U|2|XX|XX|XX|XX R|3|EK|XX|XX|XX D|4|TY|CC|CC|CC find ./*.dat -exec egrep "^A|U|I|R" \; -exec cut -d'|' -f1,2 \; -exec sort -u {} /dev/null \; But... (3 Replies)
Discussion started by: Niranjancse
3 Replies

3. Shell Programming and Scripting

perform 3 awk commands to multiple files in multiple directories

Hi, I have a directory /home/datasets/ which contains a bunch (720) of subdirectories called hour_1/ hour_2/ etc..etc.. in each of these there is a single text file called (hour_1.txt in hour_1/ , hour_2.txt for hour_2/ etc..etc..) and i would like to do some text processing in them. Each of... (20 Replies)
Discussion started by: amarn
20 Replies

4. Shell Programming and Scripting

multiple commands

Hi, I have a flat file with delimitor as X'1F' Need to get a string from second line, third field. I have problem with the below command. Below command is not correct. value=`head -2 $file_name|tail -1|cut -f3 -d`echo -e "\037"`` problem is with ` please help me to resolve this. Is there... (5 Replies)
Discussion started by: rohan10k
5 Replies

5. Solaris

Help with executing multiple remote commands after multiple hops

Hi SSHers, I have embedded this below code in my shell script.. /usr/bin/ssh -t $USER@$SERVER1 /usr/bin/ssh $USER2@S$SERVER2 echo uptime:`/opt/OV/bin/snmpget -r 0 -t 60 $nodeName system.3.0 | cut -d: -f3-5` SSH to both these servers are public-key authenticated, so things run... (13 Replies)
Discussion started by: LinuxUser2008
13 Replies

6. UNIX Desktop Questions & Answers

Multiple SQL Commands

Hello Experts !!! Im new to this so, please bear with me ! I have the following 2 sql statements create table CMD_NEW_USER as Select FD.EMPLOYEE, FD.PASTUSER, ..... FROM REPORTS FS, TASKLIST FD WHERE FS.EMPLOYEEID = FD.EMPLOYEEID ; create table CMD_OLD_USER as Select FD.EMPLOYEE,... (4 Replies)
Discussion started by: OMLEELA
4 Replies

7. Shell Programming and Scripting

Commands to multiple xterms

Hi, I need some help with sending commands to multiple xterms. What I do is ssh -Y to a remote box, and then open up 4 shells (csh) and on each one I run a different program in sequence -- one of them has 2, the first of which goes into the background and after you hit "enter" or "return" you get... (0 Replies)
Discussion started by: rmoriarty
0 Replies

8. UNIX for Advanced & Expert Users

multiple commands execution

Hi i have 3 sql scripts that need to be executed simultaneously, and independent of one another, how do i do that in Unix AIX 5.3 (1 Reply)
Discussion started by: yschd
1 Replies

9. Shell Programming and Scripting

How to do multiple commands:

NEVERMIND figured it out! (1 Reply)
Discussion started by: llsmr777
1 Replies

10. Shell Programming and Scripting

multiple sed commands

hello! I have a few sed commands sed '/^$/d' < $1 > tmp.t sed '/^ \{3,\}/d' < tmp.t > tmp1.txt ..... how can I write them in a single line? sed '/^$/d' < $1 > | '/^ \{3,\}/d' < $1 > tmp1.txt any idea? thanks. (5 Replies)
Discussion started by: george_
5 Replies
Login or Register to Ask a Question