1
在這裏,我想在bash
申報多線值的變量:定界符不保留空白行
$ GET="$(cat <<EOF
> GET/HTTP/1.1
> Host: 127.0.0.1:80
>
> EOF
>)"
這在文檔的結束是肯定的,但是空行工作失去了,
$ echo "$GET"
GET/HTTP/1.1
Host: 127.0.0.1:80
$ cat <<< "$GET"
GET/HTTP/1.1
Host: 127.0.0.1:80
更正確的答案++ – anubhava
爲什麼很重要設置'IFS'到'null'? –
@NarūnasK請參閱:https://unix.stackexchange.com/questions/18886/why-is-while-ifs-read-used-so-often-instead-of-ifs-while-read。在你的情況下,它可以適當地省略。 – andlrc