All pastes #2086729 Raw Edit

Mine

public shellscript v1 · immutable
#2086729 ·published 2011-10-04 14:32 UTC
rendered paste body
#!/bin/bash# VariablesSUB_SCRIPTS=" \  a.sh \  b.sh \"# Functionsfunction cmdExists() {  if [ ! -e $1 ]; then     return 1;  else     return 0;  fi}function hasPermToExec() {  if [ ! -x $1 ]; then    return 1;  else    return 0;  fi}function executeScript() {  sh $1;  return $?;}# first parameter is the error descriptionfunction reportErrorAndExit() {  echo "Error: $1";  exit 1;}# Execution starts herefor i in $(echo $SUB_SCRIPTS | xargs); do # Check if command exists  cmdExists $i if [ "$?" -ne 0 ]; then   reportErrorAndExit "Script $i not found"; fi # Check if the user has permission to execute script hasPermToExec $i if [ "$?" -ne 0 ]; then   reportErrorAndExit "No permissions to execute script $i"; fi # Execute Script and check return value executeScript $i if [ "$?" -ne 0 ]; then    reportErrorAndExit "Script $i exited with an error"; fidone;