views:

40

answers:

1

I have script like this : fullscript.sh

if [ ! -f /opt/laks/linux-2.6.33.2.tar.bz2 ]

then

wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.33.2.tar.bz2

tar -xjf linux-2.6.33.2.tar.bz2

fi

for i in $(seq 1 500);

do

touch /tmp/$i.txt

done

I'm downloading tar file and then decompress it and for loop creates 500 new files.

I want to run "for loop" part as background

I want to do this in a single script (fullscript.sh) - So i can't put for loop in another script and call it as ./forloop.sh &

+4  A: 

Normally you would just run a sub-shell and background that:

( for i in $seq 1 500
  do
      touch /tmp/$i.txt
  done
) &
paxdiablo
thanks ...I think this should work!
lakshmipathi