Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
public:vimbashfactory [2010/08/23 23:11] – created Nicopublic:vimbashfactory [2012/10/25 15:46] Nico
Line 1: Line 1:
-====== How to quickly create fully fonctionnal shell scripts using VIM ====== +====== How to quickly create fully functional shell scripts using VIM ======
  
   * Download the [[http://www.vim.org/scripts/script.php?script_id=1172|VIM template script]]   * Download the [[http://www.vim.org/scripts/script.php?script_id=1172|VIM template script]]
Line 6: Line 5:
   * Create the following script in .vim/templates/sh:   * Create the following script in .vim/templates/sh:
 <code> <code>
-#!/bin/bash+#!/bin/sh
  
 VERSION="$0 v1.0" VERSION="$0 v1.0"
Line 28: Line 27:
  
 #echo $# #echo $#
-if [ $# == 0 ] ; then echo "Please type $0 --help for help" >&2 ; exit 1 ; fi+if [ $# -lt 1 ] ; then echo "Please type $0 --help for help" >&2 ; exit 1 ; fi
  
 eval set -- "$TEMP" eval set -- "$TEMP"
Line 50: Line 49:
 NONE="\033[0m" NONE="\033[0m"
 fi fi
 +
 SAMPLEMESSAGE="${RED}HELLO WORLD${NONE}" SAMPLEMESSAGE="${RED}HELLO WORLD${NONE}"
  
Line 64: Line 64:
  
   * That's it! next time you will edit a new .sh file, it will load the template and automagicaly made it executable :)   * That's it! next time you will edit a new .sh file, it will load the template and automagicaly made it executable :)
 +