1. Open the terminal. Go to the directory where you want to create your script.
2. Create a file with .sh extension.
3. Write the script (in the file using an editor).
4. Make the script executable with command: chmod +x <fileName>
5. Run the script using: ./<fileName>
# Add Permissions to your script to be executable.
chmod +x /path/to/yourscript.sh
# Run your script.
/path/to/yourscript.sh
# Or if you're in the right directory.
./yourscript.sh
# if not already ran, run to change permisions executable.
chmod 755 foo.sh
# then to run the sh file
./foo.sh
sh <name of file>.sh
./yourscript.sh
#Tested on Win11
# Run script from current directory in current Terminal window/tab:
./myfile.bat
# "./" stands for "current directory"
# Run from specific path in a new tab:
wt C:my foldermyfile.bat
# You don't need to wrap the path in quotes
# Run from specific path in current window but split the pane (See 2 terminals at once):
wt split-pane C:my foldermyfile.bat
#To learn more args for the wt command go here:
https://docs.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows#options-and-commands
include
#!/bin/bash
then in terminal
chmod +x <filename>
./<filename>
sh yourfile.sh
./file.sh
./scriptname.sh
sh /path/to/file
./script-name-here.sh #Chage the "script-name-here" to the name of the .sh file.
self.returncode = subprocess. run(self.shellScriptPath, input='yes
', text=True).returncode