Shellwords(3)

πŸ“¦
version 1.08 Β· 2 versions
, in fedora 43

πŸ’– Shellwords(3) β€” aka Text::Shellwords πŸ’–

okay bestie, gather round, because this one is a vibe and also kind of a ghost πŸ‘»


✨ SYNOPSIS ✨

use Text::Shellwords;
@words = shellwords($line);
@words = shellwords(@lines);

like. that's the whole API. that's it. she's small. she's compact. she's giving minimalism πŸŽ€


🌸 DESCRIPTION 🌸

okay so real talk first: this module used to be a wrapper around shellwords.pl, but it has now been superseded by Text::ParseWords. use that module insteade (yes bestie, that's the original spelling, we're keeping the lore πŸ’…). if you use this module anyway, it will simply report the shellwords() function from Text::ParseWords.

now, the old description follows, because we keep receipts:

this is a thin wrapper around the shellwords.pl package, which comes preinstalled with Perl. this module imports a single subroutine, shellwords(). the shellwords() routine parses lines of text and returns a set of tokens using the same rules that the Unix shell does for its command-line arguments. tokens are separated by whitespace, and can be delimited by single or double quotes. the module also respects backslash escapes. πŸ¦‹βœ¨

if called with one or more arguments, shellwords() will treat each argument as a line of text, parse it, and return the tokens.

⚠️ note that the old behavior of parsing $_ if no arguments are provided is no longer supported. sorry. 😭 that's literally what it says. sorry.

🫢 BUGS 🫢

please report them. (that's it. that's the whole section. she's lowkey a woman of few words and honestly? iconic.)


πŸ‘‘ SEE ALSO πŸ‘‘

  • shellwords.pl

πŸ’œ AUTHOR πŸ’œ

Lincoln Stein <lstein@cshl.org>.

Copyright (c) 2001 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.


and that's the tea, bestie πŸ“ this was perl v5.42.0, dated 2025-07-25, and it lives in section 3 of the manual as Shellwords(3) β€” mwah, take care of her, she's retired but she's still cute πŸ§šπŸ’–

πŸ“¦ where this page comes from