Bash截取通配符在脚本中

我正在使用Bash脚本从一个文本文件,它有特殊字符(正则expression式)逐行阅读。 当我使用echo "${SOME_VAR}"它不显示文本。

我很熟悉Prevent *在bash脚本中的扩展 。

我如何显示和使用文本?

更新文本(TSV)文件包含类似的元组(最后一个条目是一个psql查询)

 bathroom bathroom select name from photos where name ~* '\mbathroom((s)?|(''s)?)\M'; 

我正在阅读CSV,如下所示:

 tail -n+2 text.file | while IFS=$'\t' read xyz do echo "${z}" done 

这给出了输出

 select name from photos where name ~* 'mbathroom((s)?|(''s)?)M'); 

注意'\'缺失

尝试使用-r标志并read

 tail -n+2 text.file | while IFS=$'\t' read -rxyz do echo "${z}" done 

read手册页:

-r不要以任何特殊的方式处理反斜杠字符。 考虑每个反斜杠是输入行的一部分。