Linux Blog

Bash Scripting Dry Run

Filed under: Quick Linux Tutorials,Shell Script Sundays — TheLinuxBlog.com at 1:37 am on Sunday, September 12, 2010

http://www.flickr.com/photos/redteam/Occasionally when scripting it is desirable to not perform an action when modifying or creating a new script. In this case it is nice to be able to do a dry run similar to –dry-run for make.


When I’m making a script I’ve learned the hard way to:

  1. Make backups before hand
  2. Make backups while performing operations
  3. Perform mock dry runs by using echo liberally.

So next time you’re trying to do something complex and don’t want to do something goofy, stick an echo in there before running it and save yourself some time.

Image Source: http://www.flickr.com/photos/redteam/

Man Pages for commands in this post »

echo

2 Comments »

Comment by Anonymous

October 5, 2011 @ 6:45 pm

Okay, but how do you do this, you freaking faggot?

Comment by TheLinuxBlog.com

October 5, 2011 @ 8:32 pm

@anon Simple: put an echo in front of it, how hard is it?

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>