#Linux Function/alias to snap create an executable bash script with the Vim editor.

in #linux4 years ago (edited)

This function will create and simultaneously open an executable file with the sha-bang line on his top and the input cursor two line below. Typical usage: vix myscript.sh

vix() {
   [ -e "$1" ] || echo -e '#!/bin/bash\n\n' > "$1";
   chmod +x "$1";
   vi "+normal G" +startinsert "$1"
   }

GitHub