From d713c9103aaeffdcf47f5ce73e2c75dac4f1b76b Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 19 Mar 2025 17:12:37 +0100 Subject: only allow ten positional args --- it.class | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index 7422d38..0733819 100644 --- a/it.class +++ b/it.class @@ -676,7 +676,7 @@ static function filter_keys($array, $keys, $p = array()) * Construct shell command using it::shell_command, log it, execute it and return output as string. * @param $cmd shell command to be executed. String may contain: * {keyword} quotes and inserts value from assoc array like ET() - * {0} .. {n} quotes and inserts positional arguments + * {0} .. {9} quotes and inserts positional arguments * {-opts} array of opts => {value,true,false,null}: it::exec('ls {-opts}', ['-opts' => ["-l" => true]]); * @param $cmd Format string with {keywords} a la ET() * @param $args varargs, contains key => val arrays or positionals for filling in cmd line. val=null expands to nothing @@ -737,7 +737,7 @@ static function shell_command($cmd, ...$args) # for escapeshellarg in it::_exec_quotevalue $oldlocale = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, 'de_CH'); - foreach (it::match('({(-?)([a-z0-9]\w*)})', $cmd, ['all' => true]) as $tags) + foreach (it::match('({(-?)([a-z]\w*|\d)})', $cmd, ['all' => true]) as $tags) { list($tag, $option, $key) = $tags; $parts = []; -- cgit v1.2.3