Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Script help

$
0
0
I am very new to unix, i have the script below and im trying to find out what it does and how is it doing it?





Code:

1: #!/bin/bash 
 2: # 
 3: # Run this script as follows: ./script 44 33 22 11 12 23 34 45 5 1 3 2 4 
 4: # 
 5: function process() { 
 6:    sleep  "$1" 
 7:    echo -n "$1 " 
 8: } 
 9:
10: for data in $*; do
11:    process "$data" &
12: done
13: wait
14: echo
15:
16: exit 0

(edit jmc remove the line numbers)
Code:

#!/bin/bash 

# Run this script as follows: ./script 44 33 22 11 12 23 34 45 5 1 3 2 4 

function process() { 
    sleep  "$1" 
    echo -n "$1 " 


for data in $*; do
    process "$data" &
done
wait
echo

exit 0


Viewing all articles
Browse latest Browse all 16232

Trending Articles