read-r.sh
来自「Shall高级编程」· Shell 代码 · 共 32 行
SH
32 行
#!/bin/bashechoecho "Enter a string terminated by a \\, then press <ENTER>."echo "Then, enter a second string (no \\ this time), and again press <ENTER>."read var1 # The "\" suppresses the newline, when reading $var1. # first line \ # second lineecho "var1 = $var1"# var1 = first line second line# For each line terminated by a "\"#+ you get a prompt on the next line to continue feeding characters into var1.echo; echoecho "Enter another string terminated by a \\ , then press <ENTER>."read -r var2 # The -r option causes the "\" to be read literally. # first line \echo "var2 = $var2"# var2 = first line \# Data entry terminates with the first <ENTER>.echo exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?