Skip to content

Instantly share code, notes, and snippets.

@cstrahan
Last active January 31, 2025 20:13
Show Gist options
  • Save cstrahan/5796653 to your computer and use it in GitHub Desktop.
Save cstrahan/5796653 to your computer and use it in GitHub Desktop.
Binary transfer script for minicom.

Configure minicom with minicom -s and enter the “File transfer protocols” section. You can add a section there called “binary”, point it at your file, and specify:

Field Value
Name Binary
Program bin-xfer -o %l
Name Y
U/D U
FullScr Y
IO-Red N
Multi N
#!/bin/sh
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
@fisherdog1
Copy link

Syntax error

/usr/bin/bin-xfer: 5: function: not found
/usr/bin/bin-xfer: 7: Syntax error: "}" unexpected

Unless I replace the first line with:

#!/bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment