批量执行Linux安装程序和脚本
1.[代码]批量执行Linux安装程序和脚本
#!/bin/bash
find -type f \( -iname '*.sh' -o -iname '*.csh' -o -iname '*.ksh' -o -iname '*.pl' -o -iname '*.bin' -o -iname '*.run' -o -iname '*.bundle' -o -iname '*.bin' -o -iname '*.class' -o -iname '*.rpm' -o -iname '*.rb' -o -iname '*.py' -o -iname '*.jar' \) -print |
while read filename
do
case "$filename" in
*.sh | *.csh | *.ksh)
if [ ! "./""$(basename $filename)" = $0 ]; then
xterm -e "$filename"
fi
;;
*.pl)
xterm -e perl "$filename"
;;
*.bin | *.run | *.bundle)
xterm -e "$filename"
;;
*.class)
xterm -e java "$(dirname "$filename")"/"$(basename "$filename" .class)"
;;
*.rpm)
xterm -e rpm -ivh "$filename"
;;
*.rb)
xterm -e ruby "$filename"
;;
*.py)
xterm -e python "$filename"
;;
*.jar)
xterm -e java -jar "$filename"
;;
esac
done