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

📄 agram2.sh

📁 Shall高级编程
💻 SH
字号:
#!/bin/bash# agram2.sh# Example of nested command substitution.#  Uses "anagram" utility#+ that is part of the author's "yawl" word list package.#  http://ibiblio.org/pub/Linux/libs/yawl-0.3.2.tar.gz#  http://personal.riverusers.com/~thegrendel/yawl-0.3.2.tar.gzE_NOARGS=66E_BADARG=67MINLEN=7if [ -z "$1" ]then  echo "Usage $0 LETTERSET"  exit $E_NOARGS         # Script needs a command-line argument.elif [ ${#1} -lt $MINLEN ]then  echo "Argument must have at least $MINLEN letters."  exit $E_BADARGfiFILTER='.......'         # Must have at least 7 letters.#       1234567Anagrams=( $(echo $(anagram $1 | grep $FILTER) ) )#          $(     $(  nested command sub.    ) )#        (              array assignment         )echoecho "${#Anagrams[*]}  7+ letter anagrams found"echoecho ${Anagrams[0]}      # First anagram.echo ${Anagrams[1]}      # Second anagram.                         # Etc.# echo "${Anagrams[*]}"  # To list all the anagrams in a single line . . .#  Look ahead to the "Arrays" chapter for enlightenment on#+ what's going on here.# See also the agram.sh script for an example of anagram finding.exit $?

⌨️ 快捷键说明

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