Date: Sat, 17 Apr 2021 08:01:01 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 255144] /bin/sh: inconsistency between implementation and manpage Message-ID: <bug-255144-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D255144 Bug ID: 255144 Summary: /bin/sh: inconsistency between implementation and manpage Product: Base System Version: 13.0-STABLE Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: freebsd@oldach.net sh(1) states about the use of alias: alias [name[=3Dstring] ...] If name=3Dstring is specified, the shell defines the alias name with value string. If just name is specified, the value of the alias name is printed. With no arguments, the alias built-in command prints the names and values of all defined aliases (see unalias). Alias values are written with appropriate quoting so that they are suitable for re-input to the shell. Also see the Aliases subsection. So I would expect that only the value is printed when asking for it. That d= oes not seem to be the case. Actually also the assignment is being printed: $ alias l l=3D'ls -laFG' $ Further the output should be suitable for being fed back into the shell. Th= at is true but actually will create a shell variable assignment in the sub-she= ll. That might be the intended behavour but IMHO is an odd deviation of /bin/sh= 's alias/variable logic: $ alias l | sh $ Linux bash behaves differently, it also outputs the "alias" command before printing name and value, so that this can be fed into a sub-shell as a comm= and, effecting the same result. bash# alias vi alias vi=3D'vim' bash# Actually what I would like to achieve is something like this: $ alias l | batch which would be possible if our /bin/sh would simply print the value, as cla= imed by the manpage. (Of course the 'l' example is not very much sensible, but t= hink of more complex alias incantations with command sequences to be submitted i= nto a batch run.) Would it make sense to align our /bin/sh code with what the manpage states?= The diff is trivial... --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-255144-227>