Updates
This commit is contained in:
22
functions/extract
Normal file
22
functions/extract
Normal file
@@ -0,0 +1,22 @@
|
||||
extract() {
|
||||
for archive in "$@"; do
|
||||
if [ -f "$archive" ]; then
|
||||
case "$archive" in
|
||||
*.tar.bz2) tar xjf "$archive" ;;
|
||||
*.tar.gz) tar xzf "$archive" ;;
|
||||
*.bz2) bunzip2 "$archive" ;;
|
||||
*.rar) unrar x "$archive" ;;
|
||||
*.gz) gunzip "$archive" ;;
|
||||
*.tar) tar xf "$archive" ;;
|
||||
*.tbz2) tar xjf "$archive" ;;
|
||||
*.tgz) tar xzf "$archive" ;;
|
||||
*.zip) unzip "$archive" ;;
|
||||
*.Z) uncompress "$archive" ;;
|
||||
*.7z) 7z x "$archive" ;;
|
||||
*) echo "'$archive' cannot be extracted via extract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$archive' is not a valid file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
5
functions/index
Normal file
5
functions/index
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
baseDir=$XDG_CONFIG_HOME/functions
|
||||
|
||||
source $baseDir/extract
|
||||
source $baseDir/myip
|
||||
6
functions/myip
Normal file
6
functions/myip
Normal file
@@ -0,0 +1,6 @@
|
||||
myip() {
|
||||
publicip=$(curl -s https://ipecho.net/plain)
|
||||
localip=$(ipconfig getifaddr en0)
|
||||
echo "Public IP: $publicip"
|
||||
echo "Local IP: $localip"
|
||||
}
|
||||
Reference in New Issue
Block a user