I can create a clickable script, by changing the .sh extension to a .tool (or .command) one. However when I do this, the paths that I have in my script break.

I am trying to run a dotnet core application and my shell script is simple:

dotnet ${PWD}/OUTPUT/Calculator.dll 

Where OUTPUT is the name of the folder with the dotnet release files in it.

if the script is a .sh file, the script runs, but then the end user has to go to the terminal and type in ./runscript.sh or whatever I call it.

The other thing I noticed was that it looks like the output of the app removes any spaces changing:

dotnet ${PWD}/OUTPUT/Calculator.dll



How do I make it so that my paths in the script don't break when I change it into a .tool extension?


As the answer suggested I have tried both:

dotnet ~/OUTPUT/Calculator

This results into:

No executable found matching command "dotnet-/Users/jeff_mba/OUTPUT/Calculator"


dotnet\ ~/OUTPUT/Calculator

which results into:

/Users/jeff_mba/Projects/calctest/runcalc.command: line 3: dotnet ~/OUTPUT/Calculator: No such file or directory

So there is a spacing issue, but if I escape the space it still says the project is not found

But as per the screenshot it really does exist.

Outside of OUTPUT folder

Inside of OUTPUT folder

  • The additional note re dotnet not being found should be a different question. The issue here is that $PATH differs if called via Terminal or via GUI
    – mmmmmm
    Commented Jun 12, 2018 at 11:25

1 Answer 1


You simply have to supply the full path to the DLL in the script.

When you run the script from Terminal.app, the PWD environment variable contains the path to the folder where you're currently placed. I.e. if you use cd to move to other folders, the PWD environment variable is automatically updated to match.

When you're using the GUI and double-clicking an icon, you're not really "in" a specific folder at the time. So the same concept of a PWD environment variable tracking your movements do not make sense.

Instead simply supply the full path in the script, such as:

dotnet ~/OUTPUT/Calculator.dll

Here ~ means that currently logged in user's home folder.

  • So does this mean that I need to have the output folder in my home directory or can it be anywhere? Commented May 7, 2018 at 17:41
  • I have updated the question with more results based on your answer - I am still having the issue Commented May 7, 2018 at 18:07
  • The output folder can be anywhere (assuming that the user has write permissions to that location).
    – jksoegaard
    Commented May 7, 2018 at 18:32
  • I think $PWD does exist in GUI programs but it is / so not much use as you describe
    – mmmmmm
    Commented Jun 12, 2018 at 11:23
  • Yes, ofcourse it exists - but it is of no use, as it is not "tracking your movements" as I describe. It is in other words useless for this specific purpose.
    – jksoegaard
    Commented Jun 12, 2018 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .