zsh-workers
 help / color / mirror / code / Atom feed
* More cygwin troubles (read builtin)
@ 2000-05-26 12:55 Andrej Borsenkow
  0 siblings, 0 replies; only message in thread
From: Andrej Borsenkow @ 2000-05-26 12:55 UTC (permalink / raw)
  To: ZSH workers mailing list

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 >>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-05-26 12:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-26 12:55 More cygwin troubles (read builtin) Andrej Borsenkow

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).