Skip to content

Janis-Rullis-IT/shell-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is a shell script?

Wiki.

Best practices

# Define error reporting level, file seperator, and init direcotry.
function init(){
    set -Eeuo pipefail; # set -o xtrace;
    IFS=$'\n\t'
    DIR=$PWD;
    ROOT_DIR="$(dirname "${DIR}")";
}
init

Avoid exit when child process fails

Comment out the set -Eeuo pipefail.

Error params

Execute in terminal

  • Create a launcher.
  • Set working directory and command.
  • Check 'Open in terminal'.

Where to look for a serious working example?

Great reads

Useful tools

Good to know

  • Remember to add backslash '' for special symbols in texts. Example, echo "I don't want it." will raise error don't: command not found and the output will become I want it.. Noticed this when pushing a commit and some of the text was missing because I used `` to highlight a code.
  • Shell scripts are very strict about spaces so if[[ ... ]] won't work because after if there should be a space.

Debugging


Started in Jan 2018