Subject: Re: ksh: escape spaces when expanding
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 09/21/1999 18:46:11
In article <199909211437.QAA14054@jdolecek.per4mance.cz>,
Jaromir Dolecek <dolecek@ics.muni.cz> wrote:
>Hi,
>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.

i.e.

% ls
foo bar.txt
% cat "foo<tab>
% cat "foo bar.txt"
% cat 'foo<tab>
% cat 'foo bar.txt'
% cat \'foo<tab>
% cat \'foo\ bar.txt

christos