[svlug] Need a shell/bash loop over each partition and execute dd && rm

Rick Moen rick at linuxmafia.com
Tue Aug 2 12:58:11 PDT 2011


Quoting Bill Ward (bill at wards.net):

> This sounds dangerous enough that automating it to such an extent would be
> fraught with peril. Perhaps having the list of filesystems stored in the
> script would be safer than trying to parse df and potentially nuking
> something you shouldn't. After all, who's to say that a future upgrade to
> the OS might not change the output format of df?

As a general approach to deal with this problem, I like my wife
Deirdre's notion of 'prototyping' the shell command, e.g., building up
using standard tools the commands you think should run, and, as the
final step when the commands are debugged and look right, piping them to
/bin/sh.  sed and awk lend themselves to that approach, well.

See:  'Awk Prototyping' on http://linuxmafia.com/kb/Devtools/





More information about the svlug mailing list