Please enable JavaScript to view the comments powered by Disqus.

[tech] Shell Script 함수 백그라운드 실행

Working

Code

#! /bin/bash

function check() {
	for idx in `seq $1 $2`
	do
		# do something
		echo $idx
	done	
}

check 1 10 &
check 11 20 &
check 21 30 &
check 31 40 &

wait

# backgroup working end
echo "end background process"

Wording

#! /bin/bash

gVal=1

function test() {
	gVal=$1
}

test 10 &

echo $gVal

참고링크