importing to repo
This commit is contained in:
parent
61e1f569aa
commit
cec7c97418
1 changed files with 39 additions and 0 deletions
39
shell/mksector.sh
Executable file
39
shell/mksector.sh
Executable 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}"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue