
我想透過以下方式將字串 America/Adak 替換為 America/Jamaica:
perl -i -pe "s/$A/$B/" /etc/sysconfig/clock
請告知 perl 語法需要更新哪些內容? (問題是我有“/”,所以需要忽略這個uniq字符,需要在我的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