Created
February 19, 2026 20:40
-
-
Save zedmatrix/f5b0d8d3e1ebc43485ca7a823a50c6b7 to your computer and use it in GitHub Desktop.
Some Quick Bash Functions
This file contains hidden or 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
| #!/bin/sh | |
| ## Quick untar and Change to directory | |
| xtar() { | |
| [ -z "$1" ] && { echo "Requires Package Name. Exiting."; return 1; } | |
| local file="$1" | |
| local dir | |
| dir=$(tar -tf "$file" | head -1 | cut -d'/' -f1) | |
| tar -xf "$file" || { echo "Tar extraction failed"; return 1; } | |
| cd "$dir" || { echo "Failed to cd into $dir"; return 1; } | |
| } | |
| export -f xtar | |
| ## Create and Change to directory | |
| mcd() { | |
| mkdir -v $1 | |
| cd $1 | |
| } | |
| export -f mcd | |
| ## Quick Create both checksums | |
| ChekSums() { | |
| [ -z "$1" ] && { echo "Requires Package Name. Exiting."; return 1; } | |
| if [[ -f "$1" ]]; then | |
| echo "SHA256: $(sha256sum $1)" | |
| echo "MD5: $(md5sum $1)" | |
| else | |
| echo "File Does Not Exist" | |
| fi | |
| } | |
| export -f ChekSums |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment