Reputation: 1018
I'm trying to run a command similar to this with bash and can't figure out how to escape the semicolon:
./script.pl data='!'"data;more_data"'!'
When my script reads the data, all it gets is "!data".
./script.pl data='!'"data\;more_data"'!'
The value I see is "!data\".
How should I be escaping the semicolon?
The Perl script uses CGI and param to get the data.
my $data = param("data");
print "$data\n";
Upvotes: 1
Views: 2334
Reputation: 1018
The problem is in Perl. The CGI library's param() function will treat semicolons as delimiters, even when a script is called on the command line.
To get param() to work correctly, escape the semicolon as %3b.
Upvotes: 2