On 05/19/2011 02:54 PM, Lee Maschmeyer wrote: > Hi all, > > For most uses, $HOME and ~ produce identical results. For example, ls > $HOME or ls ~ are the same. But the following script fails: > > 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' ']' > > 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 :) -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature