Created
August 23, 2013 14:41
-
-
Save hapylestat/6320083 to your computer and use it in GitHub Desktop.
[bash-tool] Create new script from template. How to use: - Copy script with template to installdir - Make symlink to /usr/bin or other globaly searchable directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
###################################### | |
# Shell script # | |
# Author: H.L. # | |
# TPL Version: 0.1 # | |
###################################### | |
#========================Global variables | |
APPVER="0.1b" | |
MYDIR=`echo $0` | |
MYREALDIR=`readlink $MYDIR` | |
if [ ! -z $MYREALDIR ]; then MYDIR=$MYREALDIR; fi; | |
FILENAME=`echo $MYDIR|rev|cut -d / -f 1|rev` | |
MYDIR=${MYDIR%%/$FILENAME} | |
#=======================Include base library | |
. $MYDIR/functions | |
# $1 - filename | |
if [ ! -z $1 ]; then | |
run "cp -f $MYDIR/template $PWD/$1" "Create script from template" | |
run "chmod u+x $PWD/$1" "Apply execute permissions" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment