Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

More cygwin troubles (read builtin)



this part of script tries to find out current "root" directory for
cygwin - with slightly unexpected result:

MW1G17C% mount
Device              Directory           Type         Flags
C:\cygwin\bin       /usr/bin            user         binmode
C:\cygwin\lib       /usr/lib            user         binmode
C:\cygwin           /                   user         binmode

The part of script:

mount | while read dev mpoint rest
do
    [[ $mpoint == / ]] && {
	local CYGWIN=$dev
	break
    }
done

results in

...
+/usr/local/share/zsh/site-functions/vi:8> [[ / == / ]]
+/usr/local/share/zsh/site-functions/vi:9> local CYGWIN=C:cygwin
+/usr/local/share/zsh/site-functions/vi:10> break
...

oops! read parsed input and lost backslash.

I could use "raw" read, but then, I have to check for line ends myself
... and for a long time I wish for a "read a line without parsing"
option, that may be useful anyway.

So, the suggestion is - add an option with the above meaning; then the
above could be rewritten as (assuming, -R is raw mode)

read -R line
[[ ${${=line}[2]} == / ]] && CYGWIN=${${=line}[1]}

Of course, if "device" has spaces, we get another problem ... something
like

mount "c:\my favourites" /favorites

-andrej

Have a nice DOS!
B >>



Messages sorted by: Reverse Date, Date, Thread, Author