2013-11-09 19:01:57 +01:00
|
|
|
echo Starting Backupcopy
|
|
|
|
read args
|
|
|
|
echo Arguments: $args
|
|
|
|
if [ -d "$args" ] ; then
|
|
|
|
echo "Performing backup to directory $args"
|
2014-02-02 12:17:43 +01:00
|
|
|
TARGET="$args/qubes-backup-`date +'%Y-%m-%dT%H%M%S'`"
|
2013-11-09 19:01:57 +01:00
|
|
|
echo "Copying STDIN data to $TARGET"
|
|
|
|
cat > $TARGET
|
|
|
|
else
|
|
|
|
echo "Checking if arguments is matching a command"
|
|
|
|
COMMAND=`echo $args | cut -d ' ' -f 1`
|
2015-02-05 03:14:41 +01:00
|
|
|
if which "$COMMAND"; then
|
2013-11-09 19:01:57 +01:00
|
|
|
echo "Redirecting STDIN to $args"
|
|
|
|
# Parsing args to handle quotes correctly
|
|
|
|
# Dangerous method if args are uncontrolled
|
|
|
|
eval "set -- $args"
|
|
|
|
$@
|
|
|
|
else
|
|
|
|
echo "Invalid command $COMMAND"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|