dotfiles/vim/templates/skeleton.sh

45 lines
735 B
Bash
Raw Normal View History

2017-07-26 16:06:00 +00:00
#!/bin/bash
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
BOLD=""
NORMAL=""
fi
2017-08-24 03:35:26 +00:00
error() {
printf "${BOLD}${RED}$1${NORMAL}"
}
abort() {
error "\nAborting...\n"
exit 1
}
2017-07-26 16:06:00 +00:00
set -e
cwd=$PWD
2019-05-15 18:00:25 +00:00
uname_s="$(uname -s)"
case "${uname_s}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${uname_s}"
esac
printf "${YELLOW}Platform: $machine${NORMAL}\n"