On 2015/03/09 11:19, Alexander Hall wrote: > > > On March 9, 2015 12:49:07 AM GMT+01:00, Stuart Henderson > <st...@openbsd.org> wrote: > >On 2015/03/08 15:06, Philip Guenther wrote: > >> On Sun, Mar 8, 2015 at 2:52 PM, Christian Weisgerber > ><na...@mips.inka.de> wrote: > >> > On 2015-03-08, Stuart Henderson <st...@openbsd.org> wrote: > >> > > >> >> ! needs to be escaped in tab-completion otherwise this happens. > >> >> > >> >> $ ls > >> >> Season 4 UPDATE!-FFdJhCSr8ng.mp4 > >> >> $ ls Season\ 4\ UPDATE!-FFdJhCSr8ng.mp4 > >> >> ls: Season 4 UPDATE!4: No such file or directory > >> > > >> > Huh? > >> > > >> > $ ls > >> > Season 4 UPDATE!-FFdJhCSr8ng.mp4 > >> > $ ls Season\ 4\ UPDATE!-FFdJhCSr8ng.mp4 > >> > Season 4 UPDATE!-FFdJhCSr8ng.mp4 > >> > > >> > What am I missing? > >> > >> sthen apparently has "set -o csh-history" in his profile. > > > >Ah yes, that's correct, I'd forgotten I'd set this. > > Oh, is that what makes me hate bash so much? > > Either way, in order not to escape stuff overly much, would it make > sense to make the ! escaping depend on the csh-history option?
That can be done like this, but it feels like too much magic to me. Index: edit.c =================================================================== RCS file: /cvs/src/bin/ksh/edit.c,v retrieving revision 1.39 diff -u -p -r1.39 edit.c --- edit.c 17 Dec 2013 16:37:05 -0000 1.39 +++ edit.c 9 Mar 2015 14:26:29 -0000 @@ -806,6 +806,7 @@ x_escape(const char *s, size_t len, int for (add = 0, wlen = len; wlen - add > 0; add++) { if (strchr("\"#$&'()*:;<=>?[\\]`{|}", s[add]) || + (Flag(FCSHHISTORY) && strchr("!", s[add])) || strchr(ifs, s[add])) { if (putbuf_func(s, add) != 0) { rval = -1;