DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

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



Published

Aug 28, 2013

Last Updated

Aug 28, 2013

Category

Tech

Tags

  • alias 3
  • shell 46

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor