diff options
author | jilles <jilles@FreeBSD.org> | 2013-11-10 23:00:39 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-11-10 23:00:39 +0000 |
commit | 367c40c27774d9a80d4a5b4f78ff793dbcc79ac0 (patch) | |
tree | 4510c00c70eb6cd56c4b7fa4d8138f9627a6c776 /bin | |
parent | cbf14d2794b4527754999c31302303af3770a512 (diff) | |
download | FreeBSD-src-367c40c27774d9a80d4a5b4f78ff793dbcc79ac0.zip FreeBSD-src-367c40c27774d9a80d4a5b4f78ff793dbcc79ac0.tar.gz |
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.
Diffstat (limited to 'bin')
-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 9f8e029..e2dd053 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; |