Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3EC2E7BB.5080703@mscha.org> Date: Thu, 15 May 2003 03:04:59 +0200 From: Michael Schaap User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030506 Thunderbird/0.1a X-Accept-Language: en-us, en MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Does cygstart always expand arguments? References: <3EC1A7A6 DOT 7020504 AT kleckner DOT net> In-Reply-To: <3EC1A7A6.7020504@kleckner.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-milter 0.1 @ mscha.org (http://www.amavis.org/) Jim Kleckner wrote: > > Igor Pechtchanski wrote: > >> On Tue, 13 May 2003, Jim Kleckner wrote: > > ... > >> FYI, the following works for me: >> >> cygstart gvim '"file with spaces.txt"' '"another file with spaces.txt"' > > > Yep, you did it, thanks! A gold star for you, though > definitely not as valuable as cgf's. > > Another case of peeling off layers of > "quoting the quotes". There must be some > DOS shell buried in there as part of the > invocation or something. No DOS shell involved here. (cygstart directly calls the Win32 API ShellExecute function.) It's actually the (UNIX) shell which peels of the quotes. I'll make some changes to cygstart so that arguments with whitespace will be (re-)quoted. I should be able to do this at the latest this weekend. (Note that this won't be 100% backwards compatible - for instance, this breaks the above workaround. But I think we can live with that, it's better than the current behaviour.) > > > If anyone cares, here is a small bash > snippet that will create either a shell > alias or a function to figure out which > version of gvim/vim/vimx/vi is available > to use. > Here's mine: vi() { local args="" local arg dir # Loop through arguments to command for arg; do # Is it an existing file? Translate to Windows format if [[ -f "$arg" ]]; then # Use short name iff filename contains space if [[ "$arg" != ${arg/ /} ]]; then arg=`cygpath -w -s "$arg"` else arg=`cygpath -w "$arg"` fi # Or is it a non-existing file in an existing directory (not .)? Also # translate to Windows format else dir=`dirname $arg` if [[ "$dir" != "" && "$dir" != "." && -d "$dir" ]]; then arg=`cygpath -w $arg` fi fi args="$args $arg" done # Run gvim gvim $args <&0 & disown } Note that I don't use cygstart, but run 'disown' to solve the 'problem' of job ownership. (Actually, this is my Bash version of this function. in my Zsh version, which I use normally, I run "gvim $args <&0 &!" instead.) - Michael -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/