importing to repo

This commit is contained in:
tengel 2024-03-20 12:09:54 -05:00
parent 61e1f569aa
commit cec7c97418

39
shell/mksector.sh Executable file
View file

@ -0,0 +1,39 @@
#!/usr/bin/env bash
#
# Script for https://sectordisk.pw
# usage: ./mksector.sh in.txt out.dat
#
# vim -> :set nofixendofline
# or
# vim -b <file>
# :set noeol
# :wq
#
# in.txt should be 16x32 text (~543 bytes)
# out.dat should be a 512 byte sector
#
# SPDX-License-Identifier: MIT
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <input file> <output file>"
exit 1
fi
IN="$1"
OUT="$2"
if [[ "${IN}" == "${OUT}" ]]; then
echo "Input and output files should not be the same name"
exit 2
fi
# requires GNU sed
echo
echo "Processing ${IN} to ${OUT}"
cat "${IN}" | sed ':a;N;$!ba;s/\n//g' > "${OUT}"
_SZ=$(stat -c %B "${OUT}")
echo "Bytes: ${_SZ}"
echo
hexdump -Cv "${OUT}"