diff options
author | Jilles Tjoelker <jilles@FreeBSD.org> | 2013-11-10 23:00:39 +0000 |
---|---|---|
committer | Jilles Tjoelker <jilles@FreeBSD.org> | 2013-11-10 23:00:39 +0000 |
commit | 5d4d10e3e5ca58c6e2506f15b7256b6608bf237f (patch) | |
tree | 4510c00c70eb6cd56c4b7fa4d8138f9627a6c776 /bin/sh | |
parent | 48f22b9682888947deaa75e5b276a212d4980f94 (diff) | |
download | src-5d4d10e3e5ca58c6e2506f15b7256b6608bf237f.tar.gz src-5d4d10e3e5ca58c6e2506f15b7256b6608bf237f.zip |
sh: Properly quote alias output from command -v.
An alias should be printed by command -v as a command line; therefore, make
the alias definition suitable for re-input to the shell.
Notes
Notes:
svn path=/head/; revision=257929
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/exec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/sh/exec.c b/bin/sh/exec.c index 9f8e029933eb..e2dd05374e24 100644 --- a/bin/sh/exec.c +++ b/bin/sh/exec.c @@ -672,9 +672,11 @@ typecmd_impl(int argc, char **argv, int cmd, const char *path) /* Then look at the aliases */ if ((ap = lookupalias(argv[i], 1)) != NULL) { - if (cmd == TYPECMD_SMALLV) - out1fmt("alias %s='%s'\n", argv[i], ap->val); - else + if (cmd == TYPECMD_SMALLV) { + out1fmt("alias %s=", argv[i]); + out1qstr(ap->val); + outcslow('\n', out1); + } else out1fmt("%s is an alias for %s\n", argv[i], ap->val); continue; |