2009年12月23日 星期三

How to read one line from one file as command to execute

//test.sh
#/bin/sh

cat cmdlist.txt | \
while read cmd; do
echo $cmd
sh -c "$cmd"
done


//cmdlist.txt
touch jeff.txt
echo "Hellodefefefe" > jeff.txt
touch hello.txt

沒有留言: