GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  STRING::SHELLQUOTE (3)

.ds Aq ’

NAME

String::ShellQuote - quote strings for passing through the shell

CONTENTS

SYNOPSIS



    $string = shell_quote @list;
    $string = shell_quote_best_effort @list;
    $string = shell_comment_quote $string;



DESCRIPTION

This module contains some functions which are useful for quoting strings which are going to pass through the shell or a shell-like object.
<B>shell_quoteB> [string]... <B>shell_quoteB> quotes strings so they can be passed through the shell. Each string is quoted so that the shell will pass it along as a single argument and without further interpretation. If no strings are given an empty string is returned.

If any string can’t be safely quoted <B>shell_quoteB> will <B>croakB>.

<B>shell_quote_best_effortB> [string]... This is like <B>shell_quoteB>, excpet if the string can’t be safely quoted it does the best it can and returns the result, instead of dying.
<B>shell_comment_quoteB> [string] <B>shell_comment_quoteB> quotes the string so that it can safely be included in a shell-style comment (the current algorithm is that a sharp character is placed after any newlines in the string).

This routine might be changed to accept multiple string arguments in the future. I haven’t done this yet because I’m not sure if the strings should be joined with blanks ($") or nothing ($,). Cast your vote today! Be sure to justify your answer.

EXAMPLES



    $cmd = fuser 2>/dev/null  . shell_quote @files;
    @pids = split  , `$cmd`;

    print CFG "# Configured by: ",
                shell_comment_quote($ENV{LOGNAME}), "\n";



BUGS

Only Bourne shell quoting is supported. I’d like to add other shells (particularly cmd.exe), but I’m not familiar with them. It would be a big help if somebody supplied the details.

AUTHOR

Roderick Schertler <roderick@argon.org>

SEE ALSO

perl(1).
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SHELLQUOTE (3) 2010-06-11

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.