Published by Nathan Powell on June 27, 2008 09:02 am under sysadmin
function smv(){ scp $1 $2 && rm $1; }
it would probably be useful to check the return code from the scp before continuing on with the rm.
If it doesn’t complete, the && should fail.
I call it “smoove” after Smoove B, frequent Onion contributor.
Need to catch for multiple files to a remote directory
scp $*
# puke if we have fail eeps=$? if [ “${eeps}” != “0″ ]; then echo Aiiiieeeeeeee exit ${eeps} fi
# clean up for file in $*; do [ -f ${file} ] && rm ${file} done
Nice. I didn’t account for that because it’s not something I need that often. It’s usually just me sending a file to a remote server and then my ~/ gets cluttered with these one offs everywhere.
it would probably be useful to check the return code from the scp before continuing on with the rm.
If it doesn’t complete, the && should fail.
I call it “smoove” after Smoove B, frequent Onion contributor.
Need to catch for multiple files to a remote directory
scp $*
# puke if we have fail
eeps=$?
if [ “${eeps}” != “0″ ]; then
echo Aiiiieeeeeeee
exit ${eeps}
fi
# clean up
for file in $*; do
[ -f ${file} ] && rm ${file}
done
Nice. I didn’t account for that because it’s not something I need that often. It’s usually just me sending a file to a remote server and then my ~/ gets cluttered with these one offs everywhere.