[CHANGED] added Ruby support to newscript. use /usr/bin/env more.
This commit is contained in:
parent
c7eda7c92e
commit
7f74465dcd
1 changed files with 9 additions and 4 deletions
13
newscript
13
newscript
|
|
@ -13,12 +13,17 @@ case "$TYPE" in
|
||||||
;;
|
;;
|
||||||
-pl)
|
-pl)
|
||||||
TYPE=".pl"
|
TYPE=".pl"
|
||||||
SHEBANG="#!/usr/bin/perl -w\nuse strict;"
|
SHEBANG="#!/usr/bin/env perl -w\nuse strict;"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-py)
|
-py)
|
||||||
TYPE=".py"
|
TYPE=".py"
|
||||||
SHEBANG="#!/usr/bin/python"
|
SHEBANG="#!/usr/bin/env python"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-rb)
|
||||||
|
TYPE=".rb"
|
||||||
|
SHEBANG="#!/usr/bin/env ruby"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-sh)
|
-sh)
|
||||||
|
|
@ -28,7 +33,7 @@ case "$TYPE" in
|
||||||
;;
|
;;
|
||||||
-zsh)
|
-zsh)
|
||||||
TYPE=".zsh"
|
TYPE=".zsh"
|
||||||
SHEBANG="#!/bin/zsh"
|
SHEBANG="#!/usr/bin/env zsh"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
@ -39,7 +44,7 @@ esac
|
||||||
while [[ -n ${1} ]] ; do
|
while [[ -n ${1} ]] ; do
|
||||||
SCRIPT=${SCRIPT_DIR}/${1}${TYPE}
|
SCRIPT=${SCRIPT_DIR}/${1}${TYPE}
|
||||||
if [[ -n ${TYPE} ]] && [[ ! -e ${SCRIPT} ]]; then
|
if [[ -n ${TYPE} ]] && [[ ! -e ${SCRIPT} ]]; then
|
||||||
echo -e "${SHEBANG}" > ${SCRIPT}
|
echo "${SHEBANG}" > ${SCRIPT}
|
||||||
chmod +x ${SCRIPT}
|
chmod +x ${SCRIPT}
|
||||||
elif [[ ! -e ${SCRIPT} ]]; then
|
elif [[ ! -e ${SCRIPT} ]]; then
|
||||||
touch ${SCRIPT}
|
touch ${SCRIPT}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue