
次のようにして、文字列 America/Adak を America/Jamaica に置き換えます。
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