Executing multiple commands in a file at same time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Executing multiple commands in a file at same time
# 1  
Old 06-13-2013
Executing multiple commands in a file at same time

Hi

Am having file.ksh as below
Code:
wc -l file1.txt
wc -l file2.txt
wc -l file3.txt
wc -l file4.txt


i want all the commands in this file to execute in same time

please help

Thanks in advance

Last edited by Franklin52; 06-13-2013 at 06:40 AM.. Reason: Please use code tags
# 2  
Old 06-13-2013
Add & at the end of your commands

Code:
wc -l file1.txt &
wc -l file2.txt &
wc -l file3.txt &
wc -l file4.txt &

This User Gave Thanks to anbu23 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing bash file with sudo for the second time, leads to permission denied, for some commands

I have a script that checks if the script has been ran with sudo. If the script is not ran as sudo, the current script is being executed with exec sudo bash. You are asked for a password, you type in the password, success. Everything is perfect - the commands inside the script are ran as sudo.... (1 Reply)
Discussion started by: boqsc
1 Replies

2. Emergency UNIX and Linux Support

Executing several commands in a text file

I have a file that has about 3000 commands , listed one below the other. I would like to execute them all in one go. Is there a simpler way to do it - like a batch file processing, than executing one line at a time? (3 Replies)
Discussion started by: ggayathri
3 Replies

3. Shell Programming and Scripting

Executing multiple ssh commands inside a shell simultaneously

I would like to execute a commands in four different servers through ssh at a single instance(simultaneously). Below are the details with examples, ssh user1@server1 "grep xxxx logs" ssh user1@server2 "grep xxxx logs" ssh user1@server3 "grep xxxx logs" Each statement will take some... (4 Replies)
Discussion started by: Amutha
4 Replies

4. Shell Programming and Scripting

executing commands from a file after filtering

Hi, I have a question here. Please suggest. I have a file which has some unix commands to be executed through shell scripting. The number of commands will be different every time based on some external instructions i received. I manually keep the instuctions in this file. i need to execute... (1 Reply)
Discussion started by: rbalaj16
1 Replies

5. Shell Programming and Scripting

Need help with executing multiple commands in remote machine

Hi, I work on a jumpserver and I wrote a script to transfer a file from source server to destination server. #!/bin/ksh echo "\nEnter the file name:\n" read name echo "\nSelect the Source server\n" echo "1. ODS PROD " echo "2. ODS DROPBOX" echo "3. ODS STE" echo "4. ODS STE DROPBOX"... (6 Replies)
Discussion started by: ajayakunuri
6 Replies

6. 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

7. Shell Programming and Scripting

How to read a multiple lines from a file n executing them?

Hi all, I am just trying to read the contents of a file. basically this file has a list of dat files. then i want to access these dat files n execute a script on them one by one using a loop. i hav e written like this ls -l | cut -c 58-88 > file1.txt while do arr1="$( sed -n '1p'... (7 Replies)
Discussion started by: navjyotisonu5
7 Replies

8. Shell Programming and Scripting

Automating executing commands on multiple tapes and changing (loading) them

The thing that we need to be able to do is: - Scanning tapes from failed backup jobs with bscan (a bacula command) - loading the next tape with the mtx command Bscan does unload tapes but does not load them. Bscan comes with this message when it's done with a tape: Mount Volume... (0 Replies)
Discussion started by: Tr00tY
0 Replies

9. UNIX for Dummies Questions & Answers

multiple commands to be executed at the same time

how to execute more than one command at the same time in unix .. (4 Replies)
Discussion started by: hemaa
4 Replies

10. Shell Programming and Scripting

Executing Multiple .SQL Files from Single Shell Script file

Hi, Please help me out. I have around 700 sql files to execute in a defined order, how can i do it from shell script (3 Replies)
Discussion started by: anushilrai
3 Replies
Login or Register to Ask a Question