agram.sh

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

SH
40
字号
#!/bin/bash# agram.sh: Playing games with anagrams.# Find anagrams of...LETTERSET=etaoinshrdluFILTER='.......'       # How many letters minimum?#       1234567anagram "$LETTERSET" | # Find all anagrams of the letterset...grep "$FILTER" |       # With at least 7 letters,grep '^is' |           # starting with 'is'grep -v 's$' |         # no pluralsgrep -v 'ed$'          # no past tense verbs# Possible to add many combinations of conditions and filters.#  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.gzexit 0                 # End of code.bash$ sh agram.shislanderisolateisoleadisotheral#  Exercises:#  ---------#  Modify this script to take the LETTERSET as a command-line parameter.#  Parameterize the filters in lines 11 - 13 (as with $FILTER),#+ so that they can be specified by passing arguments to a function.#  For a slightly different approach to anagramming,#+ see the agram2.sh script.

⌨️ 快捷键说明

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