diff options
author | jilles <jilles@FreeBSD.org> | 2014-01-26 21:19:33 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2014-01-26 21:19:33 +0000 |
commit | 9b565c0250634c44a36639e518e7ca3ba7a88ebd (patch) | |
tree | b13e00aabd499f2e76efcb8c8749c5884decc848 /bin/sh/tests/parser | |
parent | 51348c881e5f79078f88a6d96345fa6b4798b378 (diff) | |
download | FreeBSD-src-9b565c0250634c44a36639e518e7ca3ba7a88ebd.zip FreeBSD-src-9b565c0250634c44a36639e518e7ca3ba7a88ebd.tar.gz |
sh: Allow aliases to force alias substitution on the following word.
If an alias's value ends with a space or tab, the next word is also
checked for aliases.
This is a POSIX feature. It is useful with utilities like command and
nohup (alias them to themselves followed by a space).
Diffstat (limited to 'bin/sh/tests/parser')
-rw-r--r-- | bin/sh/tests/parser/Makefile | 2 | ||||
-rw-r--r-- | bin/sh/tests/parser/alias14.0 | 6 | ||||
-rw-r--r-- | bin/sh/tests/parser/alias15.0 | 12 | ||||
-rw-r--r-- | bin/sh/tests/parser/alias15.0.stdout | 4 |
4 files changed, 24 insertions, 0 deletions
diff --git a/bin/sh/tests/parser/Makefile b/bin/sh/tests/parser/Makefile index 6803de3..03650b1 100644 --- a/bin/sh/tests/parser/Makefile +++ b/bin/sh/tests/parser/Makefile @@ -18,6 +18,8 @@ FILES+= alias10.0 FILES+= alias11.0 FILES+= alias12.0 FILES+= alias13.0 +FILES+= alias14.0 +FILES+= alias15.0 alias15.0.stdout FILES+= and-pipe-not.0 FILES+= case1.0 FILES+= case2.0 diff --git a/bin/sh/tests/parser/alias14.0 b/bin/sh/tests/parser/alias14.0 new file mode 100644 index 0000000..1b92fc0 --- /dev/null +++ b/bin/sh/tests/parser/alias14.0 @@ -0,0 +1,6 @@ +# $FreeBSD$ + +alias command='command ' +alias alias0=exit +eval 'command alias0 0' +exit 3 diff --git a/bin/sh/tests/parser/alias15.0 b/bin/sh/tests/parser/alias15.0 new file mode 100644 index 0000000..f0fbadb --- /dev/null +++ b/bin/sh/tests/parser/alias15.0 @@ -0,0 +1,12 @@ +# $FreeBSD$ + +f_echoanddo() { + printf '%s\n' "$*" + "$@" +} + +alias echoanddo='f_echoanddo ' +alias alias0='echo test2' +eval 'echoanddo echo test1' +eval 'echoanddo alias0' +exit 0 diff --git a/bin/sh/tests/parser/alias15.0.stdout b/bin/sh/tests/parser/alias15.0.stdout new file mode 100644 index 0000000..6dd179c --- /dev/null +++ b/bin/sh/tests/parser/alias15.0.stdout @@ -0,0 +1,4 @@ +echo test1 +test1 +echo test2 +test2 |