⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex42.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# copydir.sh#  Copy (verbose) all files in current directory ($PWD)#+ to directory specified on command line.E_NOARGS=65if [ -z "$1" ]   # Exit if no argument given.then  echo "Usage: `basename $0` directory-to-copy-to"  exit $E_NOARGSfi  ls . | xargs -i -t cp ./{} $1#            ^^ ^^      ^^#  -t is "verbose" (output command line to stderr) option.#  -i is "replace strings" option.#  {} is a placeholder for output text.#  This is similar to the use of a curly bracket pair in "find."##  List the files in current directory (ls .),#+ pass the output of "ls" as arguments to "xargs" (-i -t options),#+ then copy (cp) these arguments ({}) to new directory ($1).  ##  The net result is the exact equivalent of#+   cp * $1#+ unless any of the filenames has embedded "whitespace" characters.exit 0

⌨️ 快捷键说明

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