aboutsummaryrefslogtreecommitdiffstats
path: root/main/augeas/0010-Shellvars-allow-the-builtin.patch
blob: f6a0e7050adc10e4f71e936b514d50828f6e7fbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 5f8f638b4da32a9b7ccd797b32e956a4887b5e79 Mon Sep 17 00:00:00 2001
From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
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