<html><head><style type="text/css">body {word-wrap: break-word; background-color:#ffffff;}</style></head><body><div style="font-family: sans-serif; font-size: 16px">It's not a poor practice at all. Example: gcc, which uses the executable's path as the base directory from which other files are located. MacOS also does something similar.</div><br><br>-----Original message-----<br><blockquote style="; border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family: sans-serif; font-size: 14px"><b>From: </b>Paul R &lt;paul.r.ml@gmail.com&gt;<b><br>To: </b>dokondr &lt;dokondr@gmail.com&gt;<b><br>Cc: </b>Simon Hengel &lt;simon.hengel@wiktory.org&gt;, haskell-cafe &lt;haskell-cafe@haskell.org&gt;<b><br>Sent: </b>Sun, Dec 4, 2011 15:26:28 PST<b><br>Subject: </b>Re: [Haskell-cafe] How to get a file path to the program invoked?<br><br></div>dokondr> On the contrary, standard shell variable $0 - contains a full<br>dokondr> path to the program location in the directory structure, no<br>dokondr> matter from what directory the program was called.<br><br>I don't think the comparison makes sense, as shell script invocation and<br>executable run are very different mechanisms. Whenever you invoke<br>a shell script, what really happens is that a program in your path (sh,<br>bash ...) gets started with an argument that is the path to the script<br>to load (your script actually). In this situation, you understand that<br>it is easy to provide the path to the script (the $0) : it is just the<br>file that the interpreter is loading.<br><br>I don't know if it is possible at all to get this information in the<br>context of binary execution. And I'm not sure it is a good practice<br>anyway :)<br><br>-- <br>  Paul<br><br>_______________________________________________<br>Haskell-Cafe mailing list<br>Haskell-Cafe@haskell.org<br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></blockquote></body></html>