ex65.sh

来自「Shall高级编程」· Shell 代码 · 共 29 行

SH
29
字号
#!/bin/bash#  delete.sh, not-so-cunning file deletion utility.#  Usage: delete filenameE_BADARGS=65if [ -z "$1" ]then  echo "Usage: `basename $0` filename"  exit $E_BADARGS  # No arg? Bail out.else    file=$1          # Set filename.fi  [ ! -f "$file" ] && echo "File \"$file\" not found. \Cowardly refusing to delete a nonexistent file."# AND LIST, to give error message if file not present.# Note echo message continued on to a second line with an escape.[ ! -f "$file" ] || (rm -f $file; echo "File \"$file\" deleted.")# OR LIST, to delete file if present.# Note logic inversion above.# AND LIST executes on true, OR LIST on false.exit 0

⌨️ 快捷键说明

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