shell read echo中的转义字符

最近用shell在处理数据时,发现read命令在读取数据时会把转义字符去掉,查看文档说明:加上-r解决。

cat file |while read -r line; do echo "$line"; done

-r Backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation.

你可能感兴趣的:(shell read echo中的转义字符)