Celik wrote:
On Tue, Mar 26, 2013 at 11:57 PM, jarmo <oh1mrr@xxxxxx <mailto:oh1mrr@xxxxxx>>
wrote:
Tue, 26 Mar 2013 22:23:29 +1100
Celik <celik.n.00@xxxxxxxxx <mailto:celik.n.00@xxxxxxxxx>> kirjoitti:
> Hi,
>
> Had a logic error in my bash script and did "rm -rf *" on my current
> working directory. Any tips for undoing such an error?
>
> Regards,
> C
Just try to find your BACKUP :))
Very funny :))) Didn't have a backup... :))) ohh dear laughing at lost work...:)))
Seems like I need pickup new skills on making "proper/better" backups
Thanks for making me laugh...much appreciated :)))
Actually better skills at scripting might be job one, use of "rm -rf" is ALWAYS
dangerous, I suggest putting temporary stuff in a subdir using the process id,
and deleting that at the end. If you miss you don't delete anything.
MyWk=joe-$$-$RANDOM
mkdir ${MyWk} || exit 2
# do stuff
rm -rf ${MyWk}
I would qualify that as "less unsafe" rather than idiot proof, but using both
the process id and a random number does avoid reusing a name. Note that if the
mkdir fails the script bails out immediately. Belt and suspenders programming.
--
Bill Davidsen <davidsen@xxxxxxx>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org