-a $HOME/.bashrc and -a ~/.bashrc produce different results

Lee Maschmeyer lee_maschmeyer@wayne.edu
Thu May 19 20:55:00 GMT 2011

Hi all,

For most uses, $HOME and ~ produce identical results. For example, ls $HOME 
or ls ~ are the same. But the following script fails:


for i in "$HOME/.bashrc" "~/.bashrc" ; do
    echo $i
    if [ -a "$i" ]; then
 echo "-a worked"
 echo "-a didn't work"

    if [ -e "$i" ]; then
 echo "-e worked"
 echo "-e didn't work"

The $HOME cases work; the ~ cases fail.

Presumably I'm doing something nefarious but I can't figure out what. Here's 
my ID's line from /etc/passwd:


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. :-)

Thanks for any help,

Lee Maschmeyer
Wayne State University Computing Center
5925 Woodward, #281
Detroit MI 48202
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 200262 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20110519/af59844f/attachment.obj>
-------------- next part --------------
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

More information about the Cygwin mailing list