Last updated about 1 week ago

Shell (bash | zsh)

# Usage: argsFn 1 2 3 4 5 6 7 8
argsfn() {
  echo "number of args: $#"
  echo "list of args:"; echo $@
  echo "string of args: $*"
  echo "name of script: $0"

  if [ "$#" -lt 3 ]; then
    echo "usage: $0 arg1 arg2 arg3"
    exit
  fi

  echo "first arg: $1"
  echo "second arg: $2"
  echo "third arg: $3"

  shift 3
  echo "rest of the args: $*"
}
basename -s .txt some/path/to/file.txt

SSHFS (macos)

$ brew install --cask macfuse
$ brew tap gromgit/fuse && brew install gromgit/fuse/sshfs-mac
$ sshfs -V # test if installed
$ sshfs -o allow_other,default_permissions <server-dir> <local-dir> # follow prompts for permission

On linux, sshfs should be preinstalled, if not just use default package manager

Notifications

notify() {
if [[ `uname` == Darwin ]]; then
    osascript -e 'display notification "Notification text" with title "Title"'
else
# TODO linux
# notify "Notification Text"
fi
}