arc2tarz
来自「android-w.song.android.widget」· 代码 · 共 86 行
TXT
86 行
#! /bin/bash## original from:# arc2tarz: convert arced file to tarred, compressed form.# @(#) arc2tarz.ksh 1.0 92/02/16# 91/03/28 john h. dubois iii (john@armory.com)# 92/02/16 added -h option for help## conversion to bash v2 syntax by Chet Rameyunset ENVUsage="Usage: $0 arcfile [-hcg] [ tarzfile ]"phelp(){echo "$Usagearcfile is the name of an arc file to convert to tarred, compressed form. The file must have a .arc extension, but only the base name needs to begiven. If no output file name is given, it will be created in the currentdirectory with the name being the arcfile basename followed by .tar.EXT.If the -c option is given, compress will be used, and EXT will be Z.The default (also available with -g) is to use gzip, in which case EXTis gz. If the basename is too long the extension may be truncated. Alluppercase letters in the names of files in the archive are moved to lowercase."}compress=gzipext=gzwhile getopts "hcg" opt; do case "$opt" in h) phelp; exit 0;; c) compress=compress; ext=Z;; g) compress=gzip ; ext=gz ;; *) echo "$Usage" 1>&2 ; exit 2;; esacdoneshift $((OPTIND - 1))if [ $# = 0 ]; then phelp exit 0fi[ -z "$TMP" ] && tmpdir=/tmp/arc2tarz.$$ || tmpdir=$TMP/arc2tarz.$$case "$1" in*.arc) arcfile=$1 ;;*) arcfile=$1.arc ;;esacif [ ! -f $arcfile ] || [ ! -r $arcfile ]; then echo "Could not open arc file \"$arcfile\"." exit 1ficase "$arcfile" in/*) ;;*) arcfile=$PWD/$arcfile ;;esacbasename=${arcfile%.arc}basename=${basename##*/}[ $# -lt 2 ] && tarzname=$PWD/$basename.tar.$ext || tarzname=$2trap 'rm -rf $tmpdir $tarzname' 1 2 3 6 15mkdir $tmpdircd $tmpdirecho "unarcing files..."arc -ie $arcfile# lowercasefor f in *; do new=$(echo $f | tr A-Z a-z) if [ "$f" != "$new" ]; then mv $f $new fidoneecho "tarring/compressing files..."tar cf - * | $compress > $tarznamecd -rm -rf $tmpdir
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?