I really screwed myself over recently. I have a function which will swap the contents of two files:
function swap()
{
local TMPFILE=tmp.$$
mv "$1" "$TMPFILE"
mv "$2" "$1"
mv "$TMPFILE""$2"
} ^
As you can see right near where the carrot is pointing a space is missing. As a result running the following command:
$ swap important.txt not-important.txt
causes important.txt to be overwritten by not-important.txt and important.txt is sent to the abyss of the local bash variable/file
Are there any options short of scraping the raw data on the disk?
$ grep -a -A1000 -B1000 "some text from important.txt" /dev/disk0