PADURARIU Lucian Ionut wrote:
> 
> given : 
> in ~joe a file named a.txt
> and the next script :

First off you are not reporting a bug.  This is a bug reporting
mailing list.  You are not even talking about anything to do with
sh-utils which is the focus of this list.  You are just asking for
basic help with shell programming.  This is not the appropriate forum
for that.

I suggest you try asking your question in one of the unix user lists
or news groups.

> ------------
> #!/bin/bash
> $a=joe
> test -e ~$a/a.txt && echo "yes"
> ------------
> 
> it does not output anything.
> WHY NOT ????????

Well, as long as I am here, but don't make this a habit!  Because "$a"
is not a user that can be expanded with ~user.  You need to 'eval' the
line to get another shell processing pass across it.

  #!/bin/sh
  $a=joe
  eval test -e ~$a/a.txt && echo "yes"

Compare this

  echo ~$a/a.txt

to

  eval echo ~$a/a.txt

And unless you are using bash specific features it is best if you use
#!/bin/sh instead.  Standard and portable are best.

Bob


_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to