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; } |