Saturday, February 28, 2009

More Bash tricks

While trying to figure out how to pack several scripts of functionality into a single script to make it a bit more portable (and depending on filesystem, possibly more efficient), I came up with the following concept, which has probably been used in quite a few programs before for consolidation purposes.


case "$(basename $0)" in
"rip.tv.sh")
[tv-dvd rip procedure]
;;
"rip.movie.sh")
[movie-dvd procedure]
;;
"rip.trailer.sh")
[music video or trailer rip procedure]
;;
esac

Of course, in order to use this, you then have to symlink (or hard link, your choice) the alternate names to the script to the actual script.

No comments:

Post a Comment