Skip to content
Snippets Groups Projects
Commit 07d62f23 authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Global: Added dry run option (-n) to 'cpexp'

parent d90c4e9b
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ Global
* Changed version info to be retrieved from version control system.
This requires an additional 'make' step before running
* Changed 'setconfig' to take additional config files to merged with the first
* Added dry run option (-n) to 'cpexp'
Configuration
-------------
......
......@@ -14,8 +14,15 @@ die () {
exit 1
}
CPPATHFLAGS=
if [ "x$1" = x-n ]
then
CPPATHFLAGS=-n
shift
fi
[ "x$2" = x ] && die "Oops: invalid number of parameters
Usage: $PROGRAM config_file new_exp_id [key=value...]"
Usage: $PROGRAM [-n] config_file new_exp_id [key=value...]"
CONFIG_A=$1
EXP_B=$2
......@@ -25,8 +32,8 @@ eval `getexp -v "$CONFIG_A" "$@" || echo '
' exit $?`
EXP_A=$EXP_ID
set $SCRIPT_DIR $WORK_DIR $RESTART_DIR $DATA_DIR $LOG_DIR $MON_DIR/$EXP_A ### $MON_DIR/index.html
set $SCRIPT_DIR $WORK_DIR $RESTART_DIR $DATA_DIR $LOG_DIR ${MON_DIR}${MON_DIR:+/$EXP_A} ### $MON_DIR/index.html
for PATH_A
do
cppath "$EXP_A" "$EXP_B" "$PATH_A"
cppath $CPPATHFLAGS "$EXP_A" "$EXP_B" "$PATH_A"
done
......@@ -6,6 +6,8 @@
#
PROGRAM=`basename $0`
BINDIR=`dirname $0`
PATH="$BINDIR:$PATH"
die () {
echo "$@" >&2
......@@ -33,8 +35,15 @@ cp_exp_file () {
esac
}
EXEC=
if [ "x$1" = x-n ]
then
EXEC=echo
shift
fi
[ "x$3" = x ] && die "Oops: invalid number of parameters
Usage: $PROGRAM experiment_id_a experiment_id_b path_to_a [path_to_b]"
Usage: $PROGRAM [-n] experiment_id_a experiment_id_b path_to_a [path_to_b]"
unset CDPATH
......@@ -53,7 +62,7 @@ else
PATH_B=$(dirname $PATH_B)
fi
mkdir -vp "$PATH_B"
$EXEC mkdir -vp "$PATH_B"
for DIR_A in $(
{
......@@ -63,7 +72,7 @@ for DIR_A in $(
)
do
DIR_B=`echo "$DIR_A" | sed "s,$EXP_A,$EXP_B,g"`
mkdir -vp "$PATH_B"/"$DIR_B"
$EXEC mkdir -vp "$PATH_B"/"$DIR_B"
done
for FILE_A in $(
......@@ -74,7 +83,7 @@ for FILE_A in $(
)
do
FILE_B=${FIND_B:-$(echo "$FILE_A" | sed "s,$EXP_A,$EXP_B,g")}
cp_exp_file "$EXP_A" "$EXP_B" "$PATH_A/$FILE_A" "$PATH_B/$FILE_B" ||
$EXEC cp_exp_file "$EXP_A" "$EXP_B" "$PATH_A/$FILE_A" "$PATH_B/$FILE_B" ||
STATUS=$?
done
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment