Executing statements inside forloop parallely


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Executing statements inside forloop parallely
# 8  
Old 04-30-2018
do date +%s before the loop and after wait - do the math.
# 9  
Old 04-30-2018
Given your shell - which you fail to mention, BTW - is bash, and you don't need more than second accuracy, you can save the SECONDS variable's contents before and after the loop and then calculate the difference. man bash:
Quote:
SECONDS
Each time this parameter is referenced, the number of seconds since shell invocation is returned.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing sed command inside a bash script

I want to run commands inside a bash script. An example is I want to pass the command in a string as regexp as an argument to the script, then run sed on the bash variable sed.sh regexp sed.sh "-i \"s/<p>//g\"" then call sed "$regexp" $fl (3 Replies)
Discussion started by: Kangol
3 Replies

2. Shell Programming and Scripting

Double forloop?

how do I do a double forloop or any other loops like this reads txt file a read first line read txt file b read first line then run command lun map $line1_from_txtA $line1_from_txtB exit (14 Replies)
Discussion started by: tdubb123
14 Replies

3. Shell Programming and Scripting

How to run scripts parallely inside shell script?

Hi , I have 4 scripts example script1,script2,script3,script4 . I have to run script1,script2 and script3 parallely since this 3 scripts dont have dependencies . Once script1,script2 and script3 got completed successfully , I have to trigger script4. Can someone help me on this how to... (10 Replies)
Discussion started by: vinothsekark
10 Replies

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

5. Programming

Executing a awk command inside perl script --

Hello experts I want to execute a awk command, which reads from txt files and sums the numbers from the first column for those listed only inside a <init> block -- The awk command is like awk '/<\/?init>/{x = !x}x{a++}x && a > 2{sum+=$1}END{printf"%E" "\n", sum} So, I want to execute... (2 Replies)
Discussion started by: Alkass
2 Replies

6. Shell Programming and Scripting

compare parallely

hi, i have folder backup and it contains 3 sub-directories , i want to compare /backup/1 with /recover/1 and /backup/2 with /recover/2 etc . parallelly with using shell scripting . pls help me thanks (2 Replies)
Discussion started by: shankr3
2 Replies

7. UNIX for Dummies Questions & Answers

Problem with executing command inside a cron job

Hi All, I have scheduled a script in cron which writes output to the below file. ....>> /data/Target/wrapper_invoke_ds_job_`date '+%Y%m%d'`.ksh_out 2>&1 But the date command is not getting resolved in the format specified. It just resolves to the following. wrapper_invoke_MQ_ds_job_Tue... (3 Replies)
Discussion started by: pkm_oec
3 Replies

8. Shell Programming and Scripting

executing 2 or more files inside another file parallely

hi All, i have 3 files file1 file2 file3 these 3 files are shell (KSH) scripts. i want to place all these 3 shell scripts in another file file99 and execute these files simultaneoulsy inside the file99 these 3 files should be present and executed simultaneously when i excute file99 (nohup... (1 Reply)
Discussion started by: dareman123
1 Replies

9. Shell Programming and Scripting

Problem in executing a comand liying inside a variable

Hi everyone! I need some help with my shell script :( I am sending a shell command from a html text input to a cgi. Then, I store it into a variable. For example var="ps -axu" echo `$var` This functions properly. But consider the following... var="ps -axu | grep root" Now, I want... (2 Replies)
Discussion started by: Nene
2 Replies

10. Shell Programming and Scripting

Executing statements after quit in FTP.

In my shell script I am doing FTP along with other process. But all the statements after the "quit" command in FTP are not getting executed. Example: echo "This is a shell script to FTP a file" #ftp -inv <server name> <<eol>> <logfilename> #user <userid> <password> #put <filename> #quit... (2 Replies)
Discussion started by: dharmesht
2 Replies
Login or Register to Ask a Question