From 97af31fd7a9e5b35b98d65e5d64ef00b5ff7d0b5 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 14 Apr 2020 04:48:34 -0500 Subject: Implement $'' --- toys/pending/sh.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toys/pending/sh.c b/toys/pending/sh.c index a934ee04..494ed123 100644 --- a/toys/pending/sh.c +++ b/toys/pending/sh.c @@ -921,8 +921,8 @@ dprintf(2, "TODO: do math for %.*s\n", kk, s); } } else if (cc == '$') { -// -!_0 "Special Paremeters" ($0 not affected by shift) - +// TODO: $_ is last arg of last command, and exported as path to exe run +// TODO: $! is PID of most recent background job if (!(cc = str[ii++])) { new[oo++] = cc; break; @@ -957,6 +957,8 @@ dprintf(2, "TODO: do math for %.*s\n", kk, s); if (kk) kk += TT.shift; if (kkc) ifs = TT.arg->v[kk]; } else if (cc=='\'') { + for (s = str+ii; *s != '\''; oo += wcrtomb(new+oo, unescape2(&s, 0),0)); + ii = s-str+1; } else if (cc == '{') { // $VARIABLE -- cgit v1.2.3