From 2a91fce08303a91701baf2f963771204879ab315 Mon Sep 17 00:00:00 2001 From: Lisa Milne Date: Sat, 11 Nov 2023 18:03:37 +1000 Subject: [PATCH] actually support `command substitutions` in strToArgs --- clite/core.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clite/core.js b/clite/core.js index 8b08d2f..f42f9da 100644 --- a/clite/core.js +++ b/clite/core.js @@ -1355,7 +1355,7 @@ clite.lib = { path = '/'+parts.join('/'); return path; }, - // convert a string into an argument array: 'ls /etc' -> ['ls','/etc'] + // convert a string into an argument array: 'ls /etc' -> ['ls','/etc'], supports "quoted arguments" and `command substitutions` strToArgs:function(txt) { var parts = []; var sp = ''; @@ -1377,8 +1377,12 @@ clite.lib = { if (!q) { sp = txt[i]; q = true; + if (sp == '`'); + s += '`'; break; }else if (txt[i] == sp) { + if (sp == '`'); + s += '`'; sp = ''; q = false; }