Skip to content

Instantly share code, notes, and snippets.

@ManzDev
Last active December 14, 2019 23:22
Show Gist options
  • Save ManzDev/a84fcfd41791605be9e6862fc357c338 to your computer and use it in GitHub Desktop.
Save ManzDev/a84fcfd41791605be9e6862fc357c338 to your computer and use it in GitHub Desktop.
Show command versions
#!/bin/bash
# Colors
BLUE=$(printf '\033[34m')
YELLOW=$(printf '\033[33m')
PINK=$(printf '\033[35m')
CYAN=$(printf '\033[36m')
GREEN=$(printf '\033[32m')
RED=$(printf '\033[31m')
RESET=$(printf '\033[m')
# Functions
show(){
NAME=$1
CMD=$2
BIN=$(echo "$2" | cut -d" " -f1)
WHICH=$(which $BIN)
if [ $? -eq 1 ]; then
VER="${RED}not found${RESET}"
else
VER=$(eval $2)
fi
echo -e "${BLUE}$NAME ${RESET}$VER\n ${CYAN}${WHICH}${RESET}"
}
show "linux" "lsb_release -ds"
#show "code" "code --version | head -1 | cut -d' ' -f1"
#show "codium" "codium --version"
show "node" "node --version"
show "npm" "npm --version"
show "docker" "docker --version | cut -d' ' -f3 | tr -d ,"
show "zsh" "zsh --version | cut -d' ' -f2"
show "git" "git --version | cut -d' ' -f3"
show "micro" "micro --version | head -1 | cut -d' ' -f2"
show "parcel" "parcel --version"
show "inkscape" "inkscape --version | cut -d' ' -f2"
show "chrome" "google-chrome-stable --version | cut -d' ' -f3"
show "firefox" "firefox --version | cut -d' ' -f3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment