shellwords.pl
来自「MSYS在windows下模拟了一个类unix的终端」· PL 代码 · 共 49 行
PL
49 行
;# shellwords.pl;#;# Usage:;# require 'shellwords.pl';;# @words = &shellwords($line);;# or;# @words = &shellwords(@lines);;# or;# @words = &shellwords; # defaults to $_ (and clobbers it)sub shellwords { package shellwords; local($_) = join('', @_) if @_; local(@words,$snippet,$field); s/^\s+//; while ($_ ne '') { $field = ''; for (;;) { if (s/^"(([^"\\]|\\.)*)"//) { ($snippet = $1) =~ s#\\(.)#$1#g; } elsif (/^"/) { die "Unmatched double quote: $_\n"; } elsif (s/^'(([^'\\]|\\.)*)'//) { ($snippet = $1) =~ s#\\(.)#$1#g; } elsif (/^'/) { die "Unmatched single quote: $_\n"; } elsif (s/^\\(.)//) { $snippet = $1; } elsif (s/^([^\s\\'"]+)//) { $snippet = $1; } else { s/^\s+//; last; } $field .= $snippet; } push(@words, $field); } @words;}1;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?