Cygwin: Still Awesome

By on September 8, 2004

I opined a few months ago on the beauty and joy of the command line, but I had another experience today that really illustrated the fact that GUI’s aren’t the best tool for everything.

I have both the privilege and burden of dealing with Rational Clearcase for some version control tasks. I recently wrote a large module with a number of new files, and it was time to add it to source control. Clearcase’s GUI has no ‘recursively add all these files’ function, which is one of the many ways in which it strives to suck, and succeeds beyond expectations.

Fortunately, I’ve got Cygwin on my Windows box. First up: get a list of files to check in. I want only my module, and not any of the Frontpage crap that Visual Studio adds to web projects. So, I need a list of all the files in the project, then get rid of any of them that are not in my module’s folder, then get rid of any directories that start with an underscore (the frontpage crap), then save that list to a file.

find . | grep /MyModule | sed /\/_[a-z]/d > list.txt

(Yes, there are plenty of more efficient ways to write this, but it was the first way that came to mind, and it works.)

Now I need to take each of those items and check it in to ClearCase one by one. (Clearcase has an import commandline command that would take them all at once, but I don’t have permission to run it in my environment). No sweat with bash.

for file in `cat list.txt`; do cleartool mkelem $file; done

Awesome. Two commands instead of an hour’s worth of clicking, saving me so much time that I waste it on things like posting to blogs while I wait for the checkin to finish.

You need Cygwin if you are a serious power user of any kind. Learning it will not only make you faster, it will make you more platform independent. Almost all non-Windows platforms that you run across use some variation of this syntax.



  1. I’m not sure what “don’t have permission to use it in my environment” means wrt clearfsimport, but there is an option (-nsetevent) that allows a generic VOB user to import without having to be the VOB owner….

Comments are closed. If you have something you really want to say, tweet @gadgetopia.