#!/bin/sh # # mkexec -- # # Time-stamp: "1999-03-10 22:57:09 ttate" # Require: # mv,cat,chmod LINE="#!" TARGETS= TMP=tmp MODE=ugo+x while test "$1" != "" do case "$1" in "-h"|"--help") echo "Copyright (C) 1999 by Takaaki Tateishi " echo "mkexec [-h|--help] [(-c|--command) command]" echo " [(-m|--mode) mode] file [file1 ...]" exit;; "-c"|"--command") shift; LINE="$LINE$1"; shift;; "-m"|"--mode") shift; MODE=$1; shift;; "-"*) echo "$1: unkown option"; exit;; *) TARGETS="$TARGETS $1"; shift;; esac done if test "$TARGETS" = "" then echo "no target file." exit fi for f in $TARGETS do NUM=1 while test -f $TMP$NUM do NUM=`expr $NUM + 1` done echo $LINE > $TMP$NUM cat $f >> $TMP$NUM mv -f $TMP$NUM $f chmod $MODE $f done