This works:
perl -pi -e \'s/abc/cba/g\' hellofile
But this does not:
perl -pie \'s/cba/abc/g\' hellofile
The -i
flag takes an optional argument (which, if present, must be immediately after it, not in a separate command-line argument) that specifies the suffix to append to the name of the input file for the purposes of creating a backup. Writing perl -pie 's/cba/abc/g' hellofile
causes the e
to be taken as this suffix, and as the e
isn't interpreted as the normal -e
option, Perl tries to run the script located in s/cba/abc/g
, which probably doesn't exist.