About ten times a day I do something like this:
$ cd cd tedu
ksh: cd: bad substitution

What does that even mean? According to the source, but not the manual, there
is some two argument cd syntax which substitutes something. I have never once
tried to do this on purpose.

Thus, I think the error message should be changed to be more appropriate.
Those few power users who try to substitute paths can probably deal with the
error message better than I can.

Index: c_ksh.c
===================================================================
RCS file: /cvs/src/bin/ksh/c_ksh.c,v
retrieving revision 1.50
diff -u -p -r1.50 c_ksh.c
--- c_ksh.c     21 Mar 2016 13:35:00 -0000      1.50
+++ c_ksh.c     31 Aug 2016 12:36:53 -0000
@@ -82,7 +82,7 @@ c_cd(char **wp)
                 * we don't
                 */
                if ((cp = strstr(current_wd, wp[0])) == NULL) {
-                       bi_errorf("bad substitution");
+                       bi_errorf("too many arguments");
                        return 1;
                }
                ilen = cp - current_wd;

Reply via email to