Secure Move


function smv(){
scp $1 $2 && rm $1;
}

About Nathan Powell

I am a middle aged technologist freak-ball.
This entry was posted in sysadmin. Bookmark the permalink.

5 Responses to Secure Move

  1. Jay says:

    it would probably be useful to check the return code from the scp before continuing on with the rm.

  2. If it doesn’t complete, the && should fail.

  3. Bob Igo says:

    I call it “smoove” after Smoove B, frequent Onion contributor.

  4. Patrick says:

    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

  5. 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.