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 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: Mime-Version: 1.0 Content-Type: text/plain 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: 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 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