#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
wait
Run the script.
./file.sh 6 1 3 7 8 4 2
Output :
It will sort the numbers and print them after 'printed number' seconds.
ex- 7 will be printed after 7 seconds.
No comments:
Post a Comment