summaryrefslogtreecommitdiff
path: root/shell/hush_test
diff options
context:
space:
mode:
authorDenys Vlasenko2010-09-04 19:52:44 +0200
committerDenys Vlasenko2010-09-04 19:52:44 +0200
commite298ce69baef029f3951dd1d5ed50fdbc6c55c80 (patch)
tree85060a1578474d8ca4e1d5f89e1b0c8241235ba5 /shell/hush_test
parent8ae6e9be5c1c7e7a1e9ce96f463c7d6ab1c9500f (diff)
downloadbusybox-e298ce69baef029f3951dd1d5ed50fdbc6c55c80.zip
busybox-e298ce69baef029f3951dd1d5ed50fdbc6c55c80.tar.gz
hush: fix handling of backslashes in variable assignment
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell/hush_test')
-rw-r--r--shell/hush_test/hush-vars/var_unbackslash.right11
-rwxr-xr-xshell/hush_test/hush-vars/var_unbackslash.tests23
2 files changed, 34 insertions, 0 deletions
diff --git a/shell/hush_test/hush-vars/var_unbackslash.right b/shell/hush_test/hush-vars/var_unbackslash.right
new file mode 100644
index 0000000..20c2ddf
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_unbackslash.right
@@ -0,0 +1,11 @@
+b1=-qwerty-t-\-"---z-*-?-
+b1=-qwerty-t-\-"---z-*-?-
+b2=-qwerty-\t-\-"-\--\z-\*-\?-
+b2=-qwerty-\t-\-"-\--\z-\*-\?-
+b3=-$a-\t-\\-\"-\--\z-\*-\?-
+b3=-$a-\t-\\-\"-\--\z-\*-\?-
+c=-$a-\t-\\-\"-\--\z-\*-\?-
+c=-$a-\t-\\-\"-\--\z-\*-\?-
+c=-$a-\t-\\-\"-\--\z-\*-\?-
+c=-$a-\t-\\-\"-\--\z-\*-\?-
+Done: 0
diff --git a/shell/hush_test/hush-vars/var_unbackslash.tests b/shell/hush_test/hush-vars/var_unbackslash.tests
new file mode 100755
index 0000000..3c35d7d
--- /dev/null
+++ b/shell/hush_test/hush-vars/var_unbackslash.tests
@@ -0,0 +1,23 @@
+# Test for correct handling of backslashes
+a=qwerty
+
+b=-$a-\t-\\-\"-\--\z-\*-\?-
+echo b1=$b
+echo "b1=$b"
+b="-$a-\t-\\-\"-\--\z-\*-\?-"
+echo b2=$b
+echo "b2=$b"
+b='-$a-\t-\\-\"-\--\z-\*-\?-'
+echo b3=$b
+echo "b3=$b"
+
+c=$b
+echo "c=$c"
+c=${b}
+echo "c=$c"
+c="$b"
+echo "c=$c"
+c="${b}"
+echo "c=$c"
+
+echo "Done: $?"