Subject: Re: ksh: escape spaces when expanding
To: None <firstname.lastname@example.org>
From: Christos Zoulas <email@example.com>
Date: 09/21/1999 18:46:11
In article <199909211437.QAA14054@jdolecek.per4mance.cz>,
Jaromir Dolecek <firstname.lastname@example.org> wrote:
>what always bothered me that pdksh's tab expanding doesn't really play well
>with filenames containing spaces. While playing with CygWin, I
>found out that bash uses nice hack - it just escapes the space with
>a backslash. So I implemented the same for ksh.
>Note that only spaces are currently supported. Adding e.g. tab would
>not be hard, but I haven't came across any filename containing it yet.
>If nobody would complain, I'll commit the changes shortly.
>Please keep me on CC, I'm not subscribed on tech-userlevel@NetBSD.org.
Well, that does not work properly in all cases. You need to do what tcsh does,
which is to parse the line to see if you are inside quotes.
% cat "foo<tab>
% cat "foo bar.txt"
% cat 'foo<tab>
% cat 'foo bar.txt'
% cat \'foo<tab>
% cat \'foo\ bar.txt