{"id":6831,"date":"2022-12-20T19:33:42","date_gmt":"2022-12-20T22:33:42","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/shellquote-man3\/"},"modified":"2022-12-20T19:33:42","modified_gmt":"2022-12-20T22:33:42","slug":"shellquote-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/shellquote-man3\/","title":{"rendered":"ShellQuote (man3)"},"content":{"rendered":"<h1 align=\"center\">ShellQuote<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#BUGS\">BUGS<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">String::ShellQuote \u2212 quote strings for passing through the shell<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">$string = shell_quote @list; <br \/> $string = shell_quote_best_effort @list; <br \/> $string = shell_comment_quote $string;<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">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><br \/> shell_quote<\/b> [<i>string<\/i>]&#8230;<\/p>\n<p style=\"margin-left:17%;\"><b>shell_quote<\/b> quotes strings so they can be passed through the shell. Each <i>string<\/i> is quoted so that the shell will pass it along as a single argument and without further interpretation. If no <i>string<\/i>s are given an empty string is returned.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">If any <i>string<\/i> can\u2019t be safely quoted <b>shell_quote<\/b> will <b>croak<\/b>.<\/p>\n<p style=\"margin-left:11%;\"><b>shell_quote_best_effort<\/b> [<i>string<\/i>]&#8230;<\/p>\n<p style=\"margin-left:17%;\">This is like <b>shell_quote<\/b>, excpet if the string can\u2019t be safely quoted it does the best it can and returns the result, instead of dying.<\/p>\n<p style=\"margin-left:11%;\"><b>shell_comment_quote<\/b> [<i>string<\/i>]<\/p>\n<p style=\"margin-left:17%;\"><b>shell_comment_quote<\/b> quotes the <i>string<\/i> 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).<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">This routine might be changed to accept multiple <i>string<\/i> arguments in the future. I haven\u2019t done this yet because I\u2019m not sure if the <i>string<\/i>s should be joined with blanks ($&#8221;) or nothing ($,). Cast your vote today! Be sure to justify your answer.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">$cmd = &#8216;fuser 2>\/dev\/null &#8216; . shell_quote @files; <br \/> @pids = split &#8216; &#8216;, `$cmd`; <br \/> print CFG &#8220;# Configured by: &#8220;, <br \/> shell_comment_quote($ENV{LOGNAME}), &#8220;n&#8221;;<\/p>\n<h2>BUGS <a name=\"BUGS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Only Bourne shell quoting is supported. I\u2019d like to add other shells (particularly cmd.exe), but I\u2019m not familiar with them. It would be a big help if somebody supplied the details.<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Roderick Schertler <<i>roderick@argon.org<\/i>><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>perl<\/b>(1).<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  String::ShellQuote \u2212 quote strings for passing through the shell <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3007,3196],"class_list":["post-6831","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-man3","tag-stringshellquote"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6831"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6831\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6831"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}