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

📄 crypto-quote.sh

📁 一本完整的描述Unix Shell 编程的工具书的所有范例
💻 SH
字号:
#!/bin/bash# crypto-quote.sh: Encrypt quotes#  Will encrypt famous quotes in a simple monoalphabetic substitution.#  The result is similar to the "Crypto Quote" puzzles#+ seen in the Op Ed pages of the Sunday paper.key=ETAOINSHRDLUBCFGJMQPVWZYXK# The "key" is nothing more than a scrambled alphabet.# Changing the "key" changes the encryption.# The 'cat "$@"' construction gets input either from stdin or from files.# If using stdin, terminate input with a Control-D.# Otherwise, specify filename as command-line parameter.cat "$@" | tr "a-z" "A-Z" | tr "A-Z" "$key"#        |  to uppercase  |     encrypt       # Will work on lowercase, uppercase, or mixed-case quotes.# Passes non-alphabetic characters through unchanged.# Try this script with something like:# "Nothing so needs reforming as other people's habits."# --Mark Twain## Output is:# "CFPHRCS QF CIIOQ MINFMBRCS EQ FPHIM GIFGUI'Q HETRPQ."# --BEML PZERC# To reverse the encryption:# cat "$@" | tr "$key" "A-Z"#  This simple-minded cipher can be broken by an average 12-year old#+ using only pencil and paper.exit 0#  Exercise:#  --------#  Modify the script so that it will either encrypt or decrypt,#+ depending on command-line argument(s).

⌨️ 快捷键说明

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