There’s an article at IBM DeveloperWorks about writing reusable command line utilities. The article focuses on five guidelines:

  • Do one thing well.

  • Be a filter.

  • Generalize.

  • Be robust.

  • Be new.

The article goes into some detail about each of those areas. The resources section lists The UNIX Programming Environment, and I would strongly recommend The Practice of Programming. For any level of progammer, beginner through expert, I think TPOP has something to offer.