我想用 America/Jamaica 替换字符串 America/Adak:
perl -i -pe "s/$A/$B/" /etc/sysconfig/clock
请指教在 perl 语法中需要更新什么?(问题是我有“/”,所以需要忽略这个唯一字符,我的 perl 语法需要添加什么?
A="America/Adak"
B="America/Jamaica"
CLOCK=/etc/sysconfig/clock
perl -i -pe "s/$A/$B/" $CLOCK
Bareword found where operator expected at -e line 1, near "s/America/Adak/America"
syntax error at -e line 1, near "s/America/Adak/America"
Execution of -e aborted due to compilation errors.
more $CLOCK
# The ZONE parameter is only evaluated by system-config-date.
# The timezone of the system is defined by the contents of /etc/localtime.
ZONE="America/Adak"
UTC=true
ARC=false