ex71.sh

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

SH
37
字号
#!/bin/bash#  'echo' is fine for printing single line messages,#+  but somewhat problematic for for message blocks.#   A 'cat' here document overcomes this limitation.cat <<End-of-message-------------------------------------This is line 1 of the message.This is line 2 of the message.This is line 3 of the message.This is line 4 of the message.This is the last line of the message.-------------------------------------End-of-message#  Replacing line 7, above, with#+   cat > $Newfile <<End-of-message#+       ^^^^^^^^^^#+ writes the output to the file $Newfile, rather than to stdout.exit 0#--------------------------------------------# Code below disabled, due to "exit 0" above.# S.C. points out that the following also works.echo "-------------------------------------This is line 1 of the message.This is line 2 of the message.This is line 3 of the message.This is line 4 of the message.This is the last line of the message.-------------------------------------"# However, text may not include double quotes unless they are escaped.

⌨️ 快捷键说明

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