X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <4DD58660.3070401@redhat.com> Date: Thu, 19 May 2011 15:06:40 -0600 From: Eric Blake User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: -a $HOME/.bashrc and -a ~/.bashrc produce different results References: <19A81F46A6B94CCE9372358896F3E86B AT cit DOT wayne DOT edu> In-Reply-To: <19A81F46A6B94CCE9372358896F3E86B@cit.wayne.edu> OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigC7CD22FC4A3B2BC53F58477B" 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 --------------enigC7CD22FC4A3B2BC53F58477B Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 05/19/2011 02:54 PM, Lee Maschmeyer wrote: > Hi all, >=20 > For most uses, $HOME and ~ produce identical results. For example, ls > $HOME or ls ~ are the same. But the following script fails: >=20 > Presumably I'm doing something nefarious but I can't figure out what. I can. And it's not cygwin-specific. > for i in "$HOME/.bashrc" "~/.bashrc" ; do "$HOME" expands $HOME, but "~/.bashrc" does _not_ expand ~. For tilde-expansion to occur, it must be unquoted. > if [ -a "$i" ]; then Use 'set -vx' to see what was really run. The first iteration ran: '[' '-a' '/home/blah/.bashrc' ']' while the second ran: '[' '-a' '~/.bashrc' ']' >=20 > As far as I can tell I've done everything right, but I can't believe > I've discovered a bug! I think I _am_ the bug. :-) Correct assumption, for once :) --=20 Eric Blake eblake AT redhat DOT com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigC7CD22FC4A3B2BC53F58477B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJN1YZgAAoJEKeha0olJ0NqoIEIAK0JEnLGrnewgKFxuiQcfW9E bQgxaoeOQFx4rgOAh1vXuJNBmupSKDWyS7kgguftOUBSAvOR9vLIh1AZVYP6eP/w WNkHZvpAGLhQBjJyC//NgTKhsYv2gNYKLFuZgNrHe4qfroeRkDHOydvjnBVS/3Cp GqMTB9KjyILLzGhHusB35s4kF2lVwkh/LLnbAI80SMJ2wTIkXDWCMti38N75qxde 23KC4cSYeE5KijXErwUk43zVYvXhJYLzCQI00XAw0u+Eybq9I8r06wY38SW/kJsp H7aVK8+zReSIGY0DzMm8NtYQ2idDX/QgSh0N2mloC1rCyg52rE63fjRhtim6y2k= =uAXM -----END PGP SIGNATURE----- --------------enigC7CD22FC4A3B2BC53F58477B--