delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/02/22/17:12:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Achim Gratz <Stromeko AT nexgo DOT de>
Subject: Re: $USER is not resolved in paths sometimes
Date: Fri, 22 Feb 2013 23:11:42 +0100
Lines: 40
Message-ID: <871uc8ngm9.fsf@Rainer.invalid>
References: <kg8pct$bnq$1 AT ger DOT gmane DOT org>
Mime-Version: 1.0
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.93 (gnu/linux)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Thomas Deinhamer writes:
> I'm running Cygwin and using the zsh shell.
>
> In the .zshrc file I got these lines:
> alias vboxmanage=VBoxManage
> vboxmanage setproperty machinefolder "C:\Users\$USER\VirtualBox VMs\"

You really should not use DOS paths, but if you do you should know when
they will be expanded by the shell and how often, in which case you need
to escape the backslashes accordingly.

> When I try to boot a VM using vagrant (which
> uses vboxmanage internally I think) sometimes
> $USER is not resolved to the real username.
>
> Instead vboxmanage creates a new machinefolder
> on C:/ which is then called "Users$USER" and
> inside this folder there is the folder "VirtualBox VMs",
> so the wrong path is "C:\Users$USER\VirtualBox VMs\".

No, that's exactly what you told it to create, "\$" means "insert a
literal "$".

> How could that be? Sometimes it works, sometimes it doesn't.

I don't see how the example you gave can work correctly, not even
sometimes, unless vboxmanage does interpret $USER itself (or expands its
arguments using a shell or something like that).  Which is exactly why
you shouldn't use this sort of path in the first place, since how much
escaping needs to be done depends on how many evaluations the string
goes through.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019