diff --git a/bash/fs.sh b/bash/fs.sh index df0980e..1b2e72b 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -17,3 +17,24 @@ fs_make_fat() { mkfs.fat "${@}" "${device}" fi } + +fs_wipe() { + local device="${1}" + local buffer="${2}" + local count="${3}" + if [ -b "${device}" ]; then + set -- \ + status="progress" \ + if="/dev/zero" \ + of="${device}" + if [ -n "${buffer}" ]; then + set -- "${@}" \ + bs="${buffer}" + fi + if [ -n "${count}" ]; then + set -- "${@}" \ + count=${count} + fi + dd "${@}" + fi +}