BASH Lesson 5 while loops

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
15,077
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 2, 2009

BASH Lesson 5 while loops

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 2 dislikes

Link to this comment:

Share to:

Uploader Comments (metalx1000)

  • Thank you for the wonderful tutorials. You rock!

  • @giannis321giannis321: Nope problem, you are welcome.

  • Combined with some image manipulation concepts from some of your other tutorials, this can be used as a very neat tool to clean up naughty images from one's hdd without risking unauthorized recovery of said files by nosy persons:

    ls|while read pic;do convert -modulate 0 "$pic" "$pic";done

    This will overwrite any jpg in the directory from which it is run with black pixels. However, you could just as easily perform any action you wish... Use your imagination!

  • @cmommsen1: I like that you are being creative and using the things you learn and know to come up with solutions to problems. I only see one problem. Just because you are replacing a file with the converted file doesn't mean that the new file is being written to the same place on the hard drive. So, file recovery would still be possible in some cases.

    But, still, I like that you are thinking and using your imagination.  That is a needed thing to become a good programer.

  • @metalx1000 Yeah that's a good point, especially on a complex storage configuration like RAID or SSD systems where the drive's I/O chips are performing complex caching operations.

    So what would say would be a good way to edit an file in a way that modifies the actual 1's and 0's of that file in real time? I know there are many programs for permanently erasing files, but it seems like all it should really take is a simple script or single command.

  • @cmommsen1: Well, to over write and entire drive or partition you could do something like this:

    dd if=/dev/zero of=/dev/hda

    As far as over writing certain places on a drive, I don't know. Never tried that. I'm sure there is a way. I mean besides rapidly writing and deleting files to a drive, which would not be good for the drive for a few reasons and still wouldn't grantee you got the spots you wanted.

Top Comments

  • @theif519: Sure, I'll make a video right now going over the while command a little more. Is there anything in particular you want to know?

see all

All Comments (45)

Sign In or Sign Up now to post a comment!
  • man i remembere I was able to take screenshots every few seconds with something close to this

    "while [ 1 ];do import -window root 101{1..10}.jpg;sleep 5s;done"

    but back then those 10 screenshot wouldn't be overwritten and at the 10th picture the while loop would stop. Do you have any idea.

  • @tsumulunch5 it's an error in video encoding :/ it says let x=1;

  • @metalx1000 a tutorial about arguments would be good to , please

  • @theif519: I think you mean "$#" and I think it would be more like "while [ $# -lg 3 ]" or something like that depending on the situation. But, that's getting more into arguments, not while loops. But, I will be uploading a new while loop video in a bit.

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more