Create Shortcut to Get Jar File Meta Information

You have to get meta information of cobertura.jar with command "unzip -q -c cobertura.jar META-INF/MANIFEST.MF". It's too long to write so we gonna create a shortcut "getmeta" for this command. Then we can use "getmeta cobertura" to get the same information.

In zsh, you can add following snippet into .zshrc:

getmeta() { unzip -q -c "$*".jar META-INF/MANIFEST.MF }

You can also use command "alias" to define this. But it's not general like above.

In bash, add the following snippet to .bashrc or .bash_profile:

getmeta() { unzip -q -c "$@".jar META-INF/MANIFEST.MF }

Ref:

http://stackoverflow.com/questions/2904677/alias-with-parameters

http://stackoverflow.com/questions/4060880/shell-bash-passing-argument-to-alias

posted on 2014-03-18 08:08  leechau  阅读(128)  评论(0编辑  收藏  举报

导航