ShellQuote(3)
β¨ NAME β¨
okay so bestie, this is the ShellQuote(3) page β filed under User Contributed Perl Documentation π«Ά β and the module is String::ShellQuote: quote strings for passing through the shell π
β¨
π¦ 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 π. Itβs giving βplease donβt let the shell eat my argumentβ energy, and honestly? Iconic.
π
shell_quote [string]...
shell_quote 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 β yes, empty string, no cap.
If any string canβt be safely quoted, shell_quote will croak π.
πΈ shell_quote_best_effort [string]...
This is like shell_quote, except if the string canβt be safely quoted it does the best it can and returns the result, instead of dying π«Ά. Bestie effort, literally.
π¦ shell_comment_quote [string]
shell_comment_quote 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. The author hasnβt done this yet because theyβre not sure if the strings should be joined with blanks ($") or nothing ($,) π€. Cast your vote today! Be sure to justify your answer β iykyk.
π₯ 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 π« . The author would like to add other shells (particularly cmd.exe), but theyβre not familiar with them. It would be a big help if somebody supplied the details β bestie, if thatβs you, come through π.
π AUTHOR π
Roderick Schertler <roderick@argon.org> π
π SEE ALSO π
π xoxo, this ShellQuote(3) page is from perl v5.42.0, dated 2018-01-19 β mwah, slay, bye π
π¦ where this page comes from
- opensuse-leap 16.0: perl-String-ShellQuote 1.04-160000.1.1 Β· Artistic-1.0 OR GPL-2.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms