A script that generates another script
时间:2006-08-25 来源:huanghaojie
#!/bin/sh
OUT=ge.sh
(
cat <<'EOF'
#!/bin/sh
echo "this is gerenate shell script"
a=7
b=3
let "c = $a * $b"
echo "c = $c"
EOF
) >$OUT
[ -f "$OUT" ] && chmod 755 $OUT
[ ! -f "$OUT" ] && echo "no $OUT file" ## 最后两句可写成如下
#if [ -f "$OUT" ]
#than
# chmod 755 $OUT
#else
# echo "no $OUT file"
OUT=ge.sh
(
cat <<'EOF'
#!/bin/sh
echo "this is gerenate shell script"
a=7
b=3
let "c = $a * $b"
echo "c = $c"
EOF
) >$OUT
[ -f "$OUT" ] && chmod 755 $OUT
[ ! -f "$OUT" ] && echo "no $OUT file" ## 最后两句可写成如下
#if [ -f "$OUT" ]
#than
# chmod 755 $OUT
#else
# echo "no $OUT file"
相关阅读 更多 +