hi all
I have a script to utilize the perl one liner to replace a ip address.
Code:
#!/usr/bin/ksh
set -x
PRIP=172.15.100.176
OPRIP=172.15.100.115
PNAME=oqhismfp
sub="s/${PRIP}/${OPRIP}/"
sub1=" if /\b"
sub2="${PNAME}"
sub3="\b/"
/usr/bin/perl -piw -e "'${sub}${sub1}${sub2}${sub3}'" /etc/hosts
the script runs fine. but the perl one liner seems not working at all. but if i copy the perl line to a command line, it runs correctly.
i am not a perl expert, only use it occasionally.
any one has an idea why it does not run as expect.
thanks in advance,
F.