scripts

My personal collection of scripts
git clone git://src.gearsix.net/scriptsscripts.zip
Log | Files | Refs | Atom | README | LICENSE

mkded.sh (raw) (405B)


   1 #!/usr/bin/env sh
   2 # mkded (mkdir & edit)
   3 # description: makes directory $1 and opens file $2 in $EDITOR
   4 # e.g.$ mkded ~/new file      # create ~/new/file and edit it
   5 
   6 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
   7 	echo "Usage: mkdedit DIRECTORY FILENAME"
   8 	echo ""
   9 	echo "mkdir DIRECTORY and open \$DIRECTORY/\$FILENAME in \$EDITOR"
  10 	exit
  11 fi
  12 
  13 mkdir -p $1;
  14 cd $1;
  15 if [ $2 ]; then touch $2; fi
  16 $EDITOR $2;