Create Shortcut to Get Jar File Meta Information

时间:2021-11-02 05:12:56

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://*.com/questions/2904677/alias-with-parameters

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