In my bash_profile I have this:
function ht() { perl -i -pe 's|<!-- Mirrored from (.*?) -->\n||' "$a" ;}
I want to run ht to do an inline replacement on the file fed to remove an HTML Comment with the HTTrack signature, but when I run this,
ht file.html
I get:
Can't open : No such file or directory.
I suspect this is because of the quotes around my $a which interfere with the perl command being fed. Perhaps it prefixes the " literally to the filename, or something of this nature and overall it becomes the wrong filename.
I tried removing the double quotes around my $a but that doesn't seem to do what I want. How can I resolve this?
$adefined? I don't see it in your code.$awas magical bash syntax for the command line arguments fed. I used it in another function to do the same exact thing.$@. Generally quoted, just as you have,"$@".$*but didn't notice she was trying to use "$a" instead.