找回密码
 注册
查看: 1537|回复: 0

自我解压脚本

[复制链接]
发表于 2008-1-13 21:53:09 | 显示全部楼层 |阅读模式
# !/bin/sh

[ $# != "1" ] && echo "Usage: extend.sh tarfile" && exit 0

FILENAME="$1.sh"
echo "# !/bin/sh" > $FILENAME
echo "LINES=\`wc -l \$0 | awk '{ print \$1 }'\`" >> $FILENAME
echo "LINES=\`expr \$LINES - 6\`" >> $FILENAME
echo "tail -n \$LINES \$0 > _TEMP_.tar " >> $FILENAME
echo "tar xvf _TEMP_.tar" >> $FILENAME
echo "rm _TEMP_.tar" >> $FILENAME
echo "exit 0" >> $FILENAME

chmod +x $FILENAME
cat $1 >> $FILENAME
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2022-8-18 00:17 , Processed in 0.100488 second(s), 15 queries .

© 2021 Powered by Discuz! X3.4.

快速回复 返回顶部 返回列表