Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install micro text editor from https://github.com/zyedidia/micro/releases
#!/bin/bash
#os check
case `uname -s` in
Darwin) OS="osx";;
Linux) OS="linux64";;
*) echo "unknown os: $(uname -s)" && exit 1;;
esac
#version check
echo -n "checking latest version... "
VER=`curl -sI https://github.com/zyedidia/micro/releases/latest | grep Location | sed "s~^.*tag\/v~~" | tr -d '\n' | tr -d '\r'`
if [ ! "$VER" ] ; then
echo "failed to find version"
exit 1
fi
echo "found ${VER}"
#building url
FILE="micro-${VER}-${OS}.tar.gz"
URL="https://github.com/zyedidia/micro/releases/download/v${VER}/${FILE}"
#download
PWD=`pwd`
DL=/tmp/microdl
echo "downloading: $URL" && \
mkdir -p $DL && curl -L -"#" $URL | tar zxf - -C $DL && \
cd $DL/micro-${VER}/ && \
chmod +x micro && \
((mv micro /usr/local/bin/micro > /dev/null 2>&1 && echo "installed micro to /usr/local/bin") || \
(mv micro $PWD/micro && echo "downloaded micro to $PWD")) && \
rm -rf $DL && \
mkdir -p ~/.config/micro &&
echo '{ "CtrlA": "StartOfLine", "CtrlE": "EndOfLine" }' > ~/.config/micro/bindings.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment