I have a bashscript that runs scpas follows:
echo "${SCP_PASS:-$PASSWORD}" | ( exec 3<&0; scp -qp ${SCP_PORT:+-P$SCP_PORT} -oStrictHostKeyChecking=yes -oPasswordFd=3 $TRANSFER_FILE "$SCP_USER@$SCP_HOST:$SCP_PATH" )
What is the point exec 3<&0? As I understand it, it copies the handle stdinto the file 3. Why is this necessary? Why not use -oPasswordFd=0?
source
share