in reply to The question hpunixguy2 was too scared to ask - How does he quote shell meta characters

This works for the limited test case, but as many in the CB noted, might not work for all possible cases that the shell would care about.

#!/usr/bin/perl -w use strict; while (<DATA>) { chomp; print quotemeta($_)."\n"; } __DATA__ File1^test File2!test File3-test File2\test

prints:

File1\^test File2\!test File3\-test File2\\test
  • Comment on Re: The question hpunixguy2 was too scared to ask - How does he quote shell meta characters
  • Select or Download Code