Skip to content

Instantly share code, notes, and snippets.

@seantrane
Last active November 27, 2023 14:56
Show Gist options
  • Save seantrane/557cbbae99fbe9122c76be47064b7607 to your computer and use it in GitHub Desktop.
Save seantrane/557cbbae99fbe9122c76be47064b7607 to your computer and use it in GitHub Desktop.
Shell Commands and Scripting Snippets

Commands

A collection of common shell commands.

#!/usr/bin/env bash
_DRIVE_NAME="Hot"
# Move existing backup files to external drive
mv "${HOME:-~}/Library/Application Support/MobileSync/Backup" "/Volumes/${_DRIVE_NAME:-}/Library/Application Support/MobileSync/Backup"
# Remove existing backup directory
rm -rf "${HOME:-~}/Library/Application Support/MobileSync/Backup"
# Add symlink to backup directory on external drive
ln -s "/Volumes/${_DRIVE_NAME:-}/Library/Application Support/MobileSync/Backup" "${HOME:-~}/Library/Application Support/MobileSync/Backup"
#!/usr/bin/env bash
npm init
npm install -S -D \
@commitlint/cli \
@commitlint/config-conventional \
@commitlint/travis-cli \
husky \
semantic-release \
@semantic-release/changelog \
@semantic-release/git
if [[ "$OSTYPE" == "freebsd"* ]]; then
: # FreeBSD
elif [[ "$OSTYPE" == "linux-gnu" ]]; then
: # Linux
if type "apt-get" &> /dev/null; then
: # Debian or Ubuntu:
elif type "yum" &> /dev/null; then
: # Fedora, CentOS or Red Hat:
else
: # Unknown Linux OS
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
: # macOS (Darwin)
elif [[ "$OSTYPE" == "cygwin" ]]; then
: # POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OSTYPE" == "msys" ]]; then
: # Lightweight shell and GNU utilities compiled for Windows (part of MinGW)
elif [[ "$OSTYPE" == "win32" ]]; then
: # Windows (32-bit) (...this may not work...)
else
: # Unknown OS
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment