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

Illia Bobyr Illia.Bobyr@ronin-capital.com
Thu May 19 21:00:00 GMT 2011


On 5/19/2011 3: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:
>
> #!/bin/bash
>
> for i in "$HOME/.bashrc" "~/.bashrc" ; do
>     echo $i
>     if [ -a "$i" ]; then
>  echo "-a worked"
>     else
>  echo "-a didn't work"
>     fi
>
>     if [ -e "$i" ]; then
>  echo "-e worked"
>     else
>  echo "-e didn't work"
>     fi
> done
>

Here is what I see on my box:

$ ./1.sh
/home/ibobyr/.bashrc
-a worked
-e worked
~/.bashrc
-a didn't work
-e didn't work

I guess the output on your box might be helpful in diagnosing the issue.

Ilya Bobyr

--
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