This is how I finally solved this problem for POSIX complaint system:<br><br>--<br>-- TestRun<br>--<br>module Main where<br>import System.Cmd (rawSystem)<br>import System.Directory (getCurrentDirectory)<br>import System.Environment.Executable (ScriptPath(..), getScriptPath)<br>
import System.FilePath.Posix (splitFileName)<br> <br> main = do <br>  <br>  path &lt;- getMyPath<br>  putStrLn $ &quot;myPath = &quot; ++ path<br>  let cmdLine = path ++ &quot;args.sh&quot;<br>  rawSystem cmdLine  [&quot;iphone&quot;, &quot;test-twitts.txt&quot;]<br>
   <br>{--<br>data ScriptPath Source<br><br>Constructors:<br>Executable FilePath    it was (probably) a proper compiled executable<br>RunGHC FilePath        it was a script run by runghc/runhaskell<br>Interactive                     we are in GHCi <br>
--}<br><br>getMyPath = do<br>  curDir &lt;- getCurrentDirectory -- from System.Directory<br>  scriptPath  &lt;- getScriptPath -- from System.Environment.Executable<br>  let path = getMyPath&#39; scriptPath curDir<br>  return path<br>
  <br>getMyPath&#39; (Executable path) _ = fst (splitFileName path)<br>getMyPath&#39; (RunGHC path) _  = fst (splitFileName path) <br>getMyPath&#39; Interactive curDir = curDir++&quot;/&quot;<br><br><br>-- <br>All the best,<br>
Dmitri O. Kondratiev<br><br>&quot;This is what keeps me going: discovery&quot;<br><a href="mailto:dokondr@gmail.com" target="_blank">dokondr@gmail.com</a><br><a href="http://sites.google.com/site/dokondr/welcome" target="_blank">http://sites.google.com/site/dokondr/welcome</a><br>
<br><br>