Skip to content

Instantly share code, notes, and snippets.

@LeeTroy
Last active July 25, 2023 08:43
Show Gist options
  • Save LeeTroy/24ae70eb7bcce065169d44cf10999b69 to your computer and use it in GitHub Desktop.
Save LeeTroy/24ae70eb7bcce065169d44cf10999b69 to your computer and use it in GitHub Desktop.
#!/bin/bash
INFILE=/dev/null
OUTFILE=/dev/null
function exists {
command -v $1 >/dev/null 2>&1
}
while [ $# -gt 0 ]; do
case "$1" in
-i)
shift
INFILE="$1"
;;
-o)
shift
OUTFILE="$1"
;;
-h|--help)
echo "$0 -i infile -o outfile"
;;
*)
INFILE="$1"
esac
shift
done
cat << EOF
binary-xfer utility for minicom
Sending file ${INFILE} to ${OUTFILE}
EOF
if (exists pv); then
pv --force -i 0.25 -B 128 ${INFILE} 2>&1 > ${OUTFILE}
else
cat ${INFILE} > ${OUTFILE}
fi
cat << EOF
File transfer complete
EOF
# sleep 1
# Machine-generated file - use "minicom -s" to change parameters.
pu pname10 YUYNNbin-xfer
pu pprog10 /usr/bin/bin-xfer -o %l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment