[Haskell-cafe] Happy: PATH issue

Daniel Fischer daniel.is.fischer at web.de
Sun May 2 18:21:08 EDT 2010


Am Sonntag 02 Mai 2010 22:26:43 schrieb Brandon S. Allbery KF8NH:
> On May 2, 2010, at 05:33 , Limestraël wrote:
> > Yes, it's weird, but it works! Thanks.
>
> It's normal, actually.  "~" is only understood by the shell, so unless
> the shell is invoked to expand it a program will fail to understand
> it.

If the default shell is bash and the PATH is set and exported in ~/.bashrc, 
it should work with '~' unless the string is quoted, shouldn't it?
bash expands the tildes when the value is assigned to PATH, I think.
That would explain why it's a relatively rare breakage.

> Additionally, some shells only expand "~" at the beginning of a
> "word", so if you `export PATH=~/foo:~/bar' the second "~" won't be
> expanded.  (bash will expand it after a colon, so that should work.)

Do you perchance know which shells would expand only the first tilde?

> If you quote the string, "~" won't be expanded (`export PATH="~/foo"'
> won't expand the "~").
>
> A way to check this:  type `env PATH'.

Shouldn't that be

echo $PATH

or

env | grep --regexp $PATH

?

> If the result contains a "~",
> you need to look at how you're setting PATH to make sure "~" isn't
> being quoted.

If the result contains a tilde, you're already hosed because 
System.Directory.findExecutable doesn't do tilde-expansion before calling 
doesFileExist.



More information about the Haskell-Cafe mailing list