zforce.in

来自「GNU 系统开发的基于Iz77语法的压缩 学习lz77压缩算法 」· IN 代码 · 共 46 行

IN
46
字号
:#!/bin/sh# zforce: force a z extension on all gzip files so that gzip will not# compress them twice.## This can be useful for files with names truncated after a file transfer.# 12345678901234 is renamed to 123456789012.zx=`basename $0`if test $# = 0; then  echo "force a '.z' extension on all gzip files"  echo usage: $x files...  exit 1fires=0for i do  if test ! -f "$i" ; then    echo ${x}: $i not a file    res=1    continue  fi  test `expr "$i" : '.*[.-]z$'` -eq 0 || continue  test `expr "$i" : '.*[.]t[ag]z$'` -eq 0 || continue  gzip -t "$i" 2>/dev/null || continue  if test `expr "$i" : '^.............$'` -eq 13; then    new=`expr "$i" : '\(.*\).$`.z  else    new="$i.z"  fi  if mv "$i" "$new" 2>/dev/null; then    echo $i -- replaced with $new    continue  fi  new=`expr "$i" : '\(.*\)..$`.z  if mv "$i" "$new" 2>/dev/null; then    echo $i -- replaced with $new    continue  fi  res=1; echo ${x}: cannot rename $i to $newdoneexit $res

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?