2

This question is super similar to this, but I'm curious how to launch the shell script in a non-login shell prompt. I already have it set up to run with iterm2 when I double-click. I don't really care if it uses iterm2 or Terminal, I can easily switch that if needed. I really am just interested in getting it to run in a non-login prompt.

I have my script set to run by dash (!#/usr/bin/env dash) but because it first starts up a zsh login prompt it sometimes prompts me things I don't want it to bother with (e.g., starting my ssh agent and asking if I want to update oh-my-zsh).

My guess (I might be wrong) is that if it started as a non-login prompt it wouldn't try to do these things. If it turns out that zsh non-login prompt still does this then I can probably set it up to run straight in dash in a similar way.

6
  • 1
    What app hosts your shell? And what os does that app run on? I’m assuming terminal, but we get that tag on questions for many other terminals. Just edit the details in to the body and not as a comment is best so everyone can see the setup. – bmike Feb 24 '20 at 16:46
  • Does the answer change per terminal I guess? Honestly I don't care if Terminal or iterm2 open it. I just want it to be fast haha. (But yes, I will edit it in.) – Captain Man Feb 24 '20 at 17:31
  • 1
    Why would you not use the Automator to create na application? Choose "Run Shell Script" as an action. You could copy and paste your script there. – David Anderson Feb 24 '20 at 19:09
  • I'm not entirely clear what you are trying to accomplish. Are you A) trying to run a specific shell script and just have it execute preset commands, or B) are you trying to open dash to a prompt? – TJ Luoma Feb 24 '20 at 22:57
  • @TJLuoma I'm just trying to have the script execute. I don't particularly want it to do it in a terminal window but either way is fine. As is, it opens iterm2 which opens a zsh login shell, then it basically runs script; exit (I can see this on the line before it closes). Because it opens a zsh login shell it does the things mentioned in the OP that are annoying. – Captain Man Feb 26 '20 at 17:34
1

The Automator application can be used to create an application that will run a shell script. The steps are given below.

  1. Open the Automator application.
  2. Choose New Document.
  3. Highlight the icon labeled Application, then select Choose.

  4. Under Library, select Utilities, then drag Run Shell Script to the window labeled Drag actions or files here to build your workflow.

  5. Change Pass input: to as arguments, as shown below.

  6. Replace the script with your own text. A simple example is given below.

  7. From the menu bar, select File->Save..., as shown below. When done select Save.

  8. Quit the Automator application.

  9. (Optional) Find the new application in the Finder. Right click on the new application and select Get Info. Drag and drop a new icon set (.icns) file over the existing icon for the application, as shown below.

    The result is shown below.

    Note: A .icns is not the same as a .jpg or .png file. You have to convert .jpg or .png to a .icns file before being used as a icon.

  10. Test the new application. In this case, double clicking on the icon for the new application in the Finder produces the popup shown below.

You must log in to answer this question.

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