A collection of common shell commands.
Last active
November 27, 2023 14:56
-
-
Save seantrane/557cbbae99fbe9122c76be47064b7607 to your computer and use it in GitHub Desktop.
Shell Commands and Scripting Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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