1ShellQuote(3)         User Contributed Perl Documentation        ShellQuote(3)
2
3
4

NAME

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

SYNOPSIS

9           $string = shell_quote @list;
10           $string = shell_quote_best_effort @list;
11           $string = shell_comment_quote $string;
12

DESCRIPTION

14       This module contains some functions which are useful for quoting
15       strings which are going to pass through the shell or a shell-like
16       object.
17
18       shell_quote [string]...
19           shell_quote quotes strings so they can be passed through the shell.
20           Each string is quoted so that the shell will pass it along as a
21           single argument and without further interpretation.  If no strings
22           are given an empty string is returned.
23
24           If any string can't be safely quoted shell_quote will croak.
25
26       shell_quote_best_effort [string]...
27           This is like shell_quote, excpet if the string can't be safely
28           quoted it does the best it can and returns the result, instead of
29           dying.
30
31       shell_comment_quote [string]
32           shell_comment_quote quotes the string so that it can safely be
33           included in a shell-style comment (the current algorithm is that a
34           sharp character is placed after any newlines in the string).
35
36           This routine might be changed to accept multiple string arguments
37           in the future.  I haven't done this yet because I'm not sure if the
38           strings should be joined with blanks ($") or nothing ($,).  Cast
39           your vote today!  Be sure to justify your answer.
40

EXAMPLES

42           $cmd = 'fuser 2>/dev/null ' . shell_quote @files;
43           @pids = split ' ', `$cmd`;
44
45           print CFG "# Configured by: ",
46                       shell_comment_quote($ENV{LOGNAME}), "\n";
47

BUGS

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

AUTHOR

54       Roderick Schertler <roderick@argon.org>
55

SEE ALSO

57       perl(1).
58
59
60
61perl v5.16.3                      2010-06-11                     ShellQuote(3)
Impressum