sed识别出错误的文件名

时间:2018-10-14 20:37:38

标签: bash variables sed sh

为什么sed会错误解释变量中给定的文件名? (/etc/postgresql/9.6/main/postgresql.conf解释为esql / 9.6 / main / postgresql.conf)

脚本:

#!/bin/bash
set -ex
...
echo "$psql_config_file"
${ssh_login} sudo -Hiu postgres sed -i 's/[#]*wal_level\ =.*#/wal_level\ =\ archive\ #/g' "$psql_config_file"

输出:

+ echo $'/etc/postgresql/9.6/main/postgresql.conf\r'
/etc/postgresql/9.6/main/postgresql.conf
+ ssh -t user@192.168.42.133 sudo -Hiu postgres sed -i 's/[#]*wal_level\=.*#/wal_level\ =\ archive\ #/g' $'/etc/postgresql/9.6/main/postgresql.conf\r'
: No such file or directoryesql/9.6/main/postgresql.conf

0 个答案:

没有答案