From 5f8f638b4da32a9b7ccd797b32e956a4887b5e79 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Mon, 8 Dec 2014 15:10:28 +0200 Subject: [PATCH 10/10] Shellvars: allow the [ builtin --- lenses/shellvars.aug | 2 +- lenses/tests/test_shellvars.aug | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug index 9cef3fd..07c7a52 100644 --- a/lenses/shellvars.aug +++ b/lenses/shellvars.aug @@ -78,7 +78,7 @@ module Shellvars = . del /\.|source/ "." . label ".source" . Util.del_ws_spc . store /[^;=# \t\n]+/ - let shell_builtin_cmds = "ulimit" | "shift" | "exit" + let shell_builtin_cmds = "ulimit" | "shift" | "exit" | "[" let builtin = Util.indent . label "@builtin" diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug index f38fd30..68a77ad 100644 --- a/lenses/tests/test_shellvars.aug +++ b/lenses/tests/test_shellvars.aug @@ -165,6 +165,10 @@ unset ONBOOT # We do not want this var { "@builtin" = "exit" } { "@builtin" = "exit" { "args" = "2" } } + (* Allow the [ builtin *) + test Shellvars.lns get "[ -f $FILENAME ]\n" = + { "@builtin" = "[" { "args" = "-f $FILENAME ]" } } + (* Allow wrapping builtin arguments to multiple lines *) test Shellvars.lns get "ulimit -c \\\nunlimited\nulimit \\\n -x 123\n" = { "@builtin" = "ulimit" { "args" = "-c \\\nunlimited" } } -- 1.8.3.1