How to open shell scripts

How to run a shell script on Mac (into an executable file)

Previously, we have done iOS automation packaging sharing inside is by writing a shell script to eventually generate an executable file double-click to open it can run, the actual use is very convenient method can be found online to facilitate everyone to learn here on the share how to shell scripts to make an executable file

After writing a good shell script, save it as a sh file

Next, give the shell script permissions (choose between the following two options) as an executable file

After writing a shell script, save it as a .sh file

Next, give permissions to the shell script (choose one of the following two) 1. chmoda+x your shell file 2. chmod777 your shell file

Drag the shell script to the terminal. shell script to the terminal, enter and it’s done

Here the shell script is ready to run, but how do you double-click to open it? Right-click→Open→Other…

Next you can try to double-click to execute shell scripts to put some of the tedious work with a script to write a good need to just double-click to pour a glass of water to relax a little bit, it is not fast ~

Updated 07/26/2020 There is in fact a more concise shortcut 1, cd to the target file in the directory 2, the implementation of the

3, double-click your double-click on the file you want to save.

How to run linuxshell scripts on Windows

First of all the script needs to have execute permissions chmod


There are three ways to execute the script with


. /

Features: opens a bash child process to execute, that is, opens an additional process to do so, without affecting the variables, configuration, etc. of the original process



Features: and . / same





Features: executes the script in the original bash process.

The third method is mainly used for commands such as switching user su, switching directory cd, etc. in the script.




commands are the same.

You can search for


Additionally, how to see if a script is running with the bash sub-process enabled



#! /bin/bash


The $$ command outputs the bash process ID



Save it and give it executable permissions chmod


Type it into your shell. echo


Screen output 4176

. /

Screen output 3600


Screen output 3984


Screen output 4176

The same as what you typed in your shell. which means it’s in the same bash process