Introduction

Last edited

Scripting vs Programming?

There’s no real distinction between “scripting” and “programming but generally…”

Pithy

Scripting is the use of software as a kind of universal glue that binds various commands, libraries and configuration files into a more functional whole. While programming is the writing of the those smaller scoped libraries.

Scripting philosophies

Tip

Write small scripts - you achieve most efficiencies by saving a few keystrokes here and a few commands there As a general rule, approach every chore with the question, “How can I avoid having to deal with this issue again in the future?”
Keep small scripts in ~/bin

$PATH Variable

$PATH is just a convention like any other

  • It’s an environment variable
  • It tells your shell where to check when you call for a executable (binary or script)
  • It searches in order, picking the first executable that matches
# Format:
# It's a list of folders seperate by colons
echo $PATH | column -t -s :
/home/mat/.cargo/bin  /usr/local/sbin  /usr/local/bin  /usr/sbin  /usr/bin  /sbin  /bin  /usr/games  /usr/local/games  /snap/bin

# Config (RC = run commands)
export PATH="$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH"
/home/mat/bin
home/mat/.local/bin
/usr/local/bin
$PATH  # This is a must because your shell inherits the env vars from your parent process.
# This variable will add it your new list of paths
# Some of these are added at login time using the ~/.profile script