#!/bin/bash # expand path prg_path=${0%/*} export PATH=$prg_path/../lib:$PATH export PERLLIB=$prg_path/../lib export PERL5LIB=$prg_path/../lib # make HOSTNAME to a regular environment variable export M_HOST=$HOSTNAME . $PERLLIB/mCM.lib usage="$0: mCM OPTIONS [] -h|--help -b|--batch: batchmode, -a|--answer y/n: default answer" TEMP=$(getopt -o hba: --long help,batch,answer: -n $0 -- "$@") eval set -- "$TEMP" # provide default values: batch=0 default_answer=u #unknown while true do case "$1" in -h | --help ) echo $usage; exit ;; -b | --batch ) batch=true; shift ;; -a | --answer ) default_answer=$2 ; shift; shift ;; -- ) shift; break ;; * ) break ;; esac done if [ "$1" != "" ] then dir_list=$1 else # regex-Ausdruck unterdrückt .Verzeichnisse dir_list=$(find . -maxdepth 1 -type d -regex "^./[^\.].*") fi # store start dir base_dir=$PWD for dir in $dir_list do cd $dir evalCm if [ $evalCm_result != "unknown" ] then echo "processing $dir ..." evalCmStatus up.out || error_exit evalCmStatus up.out errlog: /tmp/syserr buildToDoList.pl up.out up.tmp $batch || error_exit buildToDoList.pl up.out up.tmp cat up.tmp CM2cm echo wc=$(wc -l up.sh) answer=$default_answer if [ "${wc:0:1}" != "1" ] then cat up.sh if [ "$answer" == "u" ] then echo "execute ? (y)/n" read answer fi fi if [ $batch == true ] then cp up.sh $base_dir/$dir.batch else if [ "$answer" != "n" ] then . up.sh fi fi rm up.* fi # return to start dir cd $base_dir done