We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

willcodeforfood on 12/16/07


Tagged

bashrc


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

nimoyjohnson


Alias for compressing files


Published in: Bash 


URL: http://bashscripts.org/viewtopic.php?t=231

http://bashscripts.org/viewtopic.php?t=231

  1. compress () {
  2. FILE=$1
  3. case $FILE in
  4. *.tar.bz2) shift && tar cjf $FILE $* ;;
  5. *.tar.gz) shift && tar czf $FILE $* ;;
  6. *.tgz) shift && tar czf $FILE $* ;;
  7. *.zip) shift && zip $FILE $* ;;
  8. *.rar) shift && rar $FILE $* ;;
  9. esac

Report this snippet 

You need to login to post a comment.