Thorsten Glaser <tg <at> mirbsd.de> writes: mirabilos -
> > This has been the case since mksh R17, youb> notice this. Ib> issue and the > bugs fixed that introduced this issue were *much* > worse. (Sorry about that. Need to be realistic here. I did spend > hours yesternight on this.) > Thank you for your hard work. I once remarked to you that it must be a lonely road - I hope I was wrong. > No problem, hope youb So far so good. Seems on par with dash's quickness and far more capable. I just wish I could get to the next line with CTRL-V CTRL-J. It's a stupid habit I picked up rather than using a proper editor. Guess it's time to break that habit, anyway. I do particularly like the dex editor, though. https://github.com/tihirvon/dex > An aside to the two of you: Googlemail has issues with greylisting. > Mails from you may reach my server with weeks delay or not at all. > Posting through GMane should be fine, though b> which Lars still has not > fixed. > > Right. A comparison to AT&T ksh93 shows that: > > mksh$ typeset -p nq > typeset nq=space > ksh93$ typeset -p nq > nq=$'spacedivdedargument\nhere' > > Everything else is the same though. (GNU bash behaves like AT&T ksh93, > and with dash all hopes are off, anyway.) I think I might be reporting the dash bug myself, as soon as I can narrow it down. I have discovered one weird behavior surrounding this sort of thing in that shell, though. In any case, any portable bit that I try to write can be done as simply as s="$*". It's a little weird, maybe, but seems to be equally respected in every shell I've tried. This is not a difficult workaround by any means. > mksh$ b=${a//[! ]}; echo ${#b} > 3 > > This also works in GNU bash and AT&T ksh93. I know, but it's where it doesn't work that bugs me. > This is alright. I just really hate some parts of POSIXb> and it doesnb> > cases is not straightforward, in the existing codebase. I've been experimenting with writing out a shell sourceable argument array that I can call on from any shell. Here's one way I *think* I have managed to get everyone to cooperate: It's a bit long, so don't get impatient. I think it's pretty simple though. qchk() { $1 -s -- "$@" ; } <<\SCRIPT sq() ( chkpr() { case $# in (0) case "${ZSH_VERSION:+?}" in (?) emulate sh ;; esac ;; (1) case "$1" in ([!\']*) spl "$1" ;; (\'*) case "${KSH_VERSION}" in (*MIRBSD*) spl "'$1" ;; (*) spl "$1" ;; esac ;; (*) printf "'' " ;; esac ;; (*) return 1 ;; esac } spl() { IFS=\' ; set -f ; set -- $* printf \'%s "$1" ; shift printf "'\\\\''%s" "$@" printf "' " } chkpr while [ $# -gt 0 ] do chkpr "$1" shift ; done ; echo ) shift ; sq "$@" SCRIPT printf '<%s>\n\n' * for sh in mk z ya da ba '' do echo ${sh}sh qchk ${sh}sh * '' eval [ -e "$(qchk ${sh}sh *)" ] && echo "hooray!" echo done So far it caters to three shells' peculiarities, though I have no doubt that list will grow as I discover them, and I don't have a ksh93 to work with. 2 are obvious - zsh and mksh - in the chkpr() function. But one that is less so is dash. I should be able to do: ... printf "'\\\\''%s" "$@' " ... But dash gets upset and so I need the next line. Anyway, regarding mksh, I have only to check if the very first split char is the split delimiter, and, if so, add another. It isn't difficult to do. The sequence above puts this on my screen when run from my test directory: '' horribly misguided filename''''''""""\\\and so on> mksh '\''' horribly misguided filename'\'''\'''\'''\'''\'''\''""""\\\and so on' '' hooray! zsh '\''' horribly misguided filename'\'''\'''\'''\'''\'''\''""""\\\and so on' '' hooray! yash '\''' horribly misguided filename'\'''\'''\'''\'''\'''\''""""\\\and so on' '' hooray! dash '\''' horribly misguided filename'\'''\'''\'''\'''\'''\''""""\\\and so on' '' hooray! bash '\''' horribly misguided filename'\'''\'''\'''\'''\'''\''""""\\\and so on' '' hooray! sh '\''' horribly misguided filename'\'''\'''\'''\'''\'''\''""""\\\and so on' '' hooray! You don't get to see the first < from the printf at the top of the function because there's a return character in the filename - but it's still there. Thanks again, mirabilos. -mike