Skip to content

Instantly share code, notes, and snippets.

@markhowellsmead
Created April 21, 2022 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markhowellsmead/b6fdd63825599d07d363c3e211856e67 to your computer and use it in GitHub Desktop.
Save markhowellsmead/b6fdd63825599d07d363c3e211856e67 to your computer and use it in GitHub Desktop.
Bash script with coloured messaged
#!/bin/bash
function cecho(){
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[0;33m"
NC="\033[0m" # No Color
printf "${!1}\n${2} ${NC}"
}
read -p "Updates the theme and all SH plugins. Are you sure? " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
cecho "RED" "Aborted"
exit 1
fi
cecho "YELLOW" "Updating…"
ssh USER@SERVER -A "sh ~/public_html/updateall.sh"
cecho "GREEN" "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment