Register
It is currently Fri Oct 31, 2014 4:53 pm

Need help for a begginer script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Fri Jun 24, 2011 3:15 pm   

Joined: Fri Jun 24, 2011 2:46 pm
Posts: 8
#/bin/sh

# how to ask to the user to enter his admin authentification (SU) ?
# and how to keep it applicated after the end of this small script ?
# how to replace my admin name (adminname) by the one of the user ?

# program name: eraser

while [ "$eraser" -lt '7' ] ; do
rm -rf /Users/adminname/.Trash/
eraser="$(expr "$eraser" '+' '1')"
echo "The eraser has empty the trash securely"
done

# you understood what I want, just a small script which erase successively seven times the trash.
# I have another problem (I run under OS X ), when I run the following command line :
# sudo rm -rf /Users/adminname/.Trash/
# when I put a file to the trash, the system do not keep it in the trash. It erases it instantly
# it's like I was running the command line once again.
# this is a problem. I do not want any system settings changed
# last question : How do I do to "see", to "be sure", that the system, with this script, empty the trash 7 times?



Thanks for all.

I'm new here and hope this forum is serious, 'cause there is not a lot of forums with members who speaks about that and which is looking to getting advanced in bash.


Top
 Profile  
 PostPosted: Fri Jun 24, 2011 11:41 pm   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
1) You cannot delete a file or folder more than once. When it's gone, it's gone. Deleting something 7 times is impossible.
2) If you delete your .Trash folder, OSX cannot store anything there anymore, so any subsequent 'delete' of a file, cannot be stored in .Trash (since you already removed it).
3) use [code] tags around the script you post here... It's crap to read right now.

As a suggestion, if you want to 'securely delete' something, you can overwrite the contents of a file with rubbish of the same size, before actually deleting it.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP