Mercurial > repos > david-hoover > local_file_tools
view export_local_file.sh @ 4:dd15479a0863
Uploaded
| author | david-hoover |
|---|---|
| date | Tue, 28 Feb 2012 13:00:14 -0500 |
| parents | c772c8912663 |
| children |
line wrap: on
line source
### ### The shell script: export_local_file.sh ### ### The script basically copies a Galaxy dataset (param 1, dataset_NNNNN.dat) ### to the destination file (param 2, {/data,/home}/filename ### #!/bin/sh INPUT="$1" DEST="$2" EMAIL="$3" OUTPUT="$4" USER=`echo $EMAIL | sed -e 's#@.*##'` if [ -z "$DEST" ]; then echo "Usage: $0 [INPUT] [DEST]" >&2 exit 1 fi # Filter any unwanted directories if [[ `echo $DEST | grep -c ^/data/` -lt 1 ]] && [[ `echo $DEST | grep -c ^/home/` -lt 1 ]] ; then echo "Error: \"$DEST\" is not allowed" >&2 exit 1 fi # Do the deed cpy $INPUT $DEST "$USER" dataset=`basename $INPUT` if [ $? != 0 ]; then echo "Error: $USER failed to copy dataset $dataset to \"$DEST\"" >&2 exit 1 fi echo "Dataset $dataset successfully exported to \"$DEST\"" >> $OUTPUT exit 0 ### ### ###
