为什么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