From 13d523967df35f697f2a9644a411572231d3a5b4 Mon Sep 17 00:00:00 2001 From: SkyperTHC Date: Sun, 19 Mar 2023 16:58:20 +0000 Subject: [PATCH] shred --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e6e0ee7..ce035df 100644 --- a/README.md +++ b/README.md @@ -862,7 +862,13 @@ shred -z foobar.txt **7.ii. Shred & Erase without *shred*** ```sh -FN=foobar.txt; dd bs=1k count="`du -sk \"${FN}\" | cut -f1`" if=/dev/urandom >"${FN}"; rm -f "${FN}" +shred() +{ + [[ -z $1 || ! -f "$1" ]] && { echo >&2 "shred [FILE]"; return 255; } + dd bs=1k count=$(du -sk ${1:?} | cut -f1) if=/dev/urandom >"$1" + rm -f "${1:?}" +} +shred foobar.txt ``` Note: Or deploy your files in */dev/shm* directory so that no data is written to the harddrive. Data will be deleted on reboot.