Good morning everyone!
I need a little brain-storming to create a function whose job is to determine how to extract an archive file based on the filename.
However, of course, there's a million archive formats out there, so we need to build a laundry list of file extensions along with the command to extract with.
For example:
case $1 in
*.tar) CMD="tar -xf" ;;
*.tar.gz) CMD="tar -zxf" ;;
*.tar.bz) CMD="tar -jxf" ;;
*.tar.bz2) CMD="tar -jxf" ;;
*.7z) CMD="7z x -so" ;;
*.rar) CMD="unrar x -r" ;;
*.zip) CMD="unzip -a" ;;
esac
The goal here is to have a working list of commands of supported software, create extensions if necessary for software we don't already have in the repository and have this function detect whether or not said extensions are currently installed. Please list all of the file extensions you can think of along with their associated command to EXTRACT into the CURRENT directory. The above examples were "off the top of my head" so they may not be completely accurate.
The "ultimate" goal is to have the fewest number of extensions needing to be installed in order to support the largest number of archive formats.
This function will also be supporting ISO, RPM, DEB, CPIO and other containers, we probably won't need to support extensions like CAB for obvious reasons, but there's archives out there such as ACE, ALZ, LZH, etc. which aren't overly common today, but worthwhile to implement if they don't require closed source software.
Any file extensions you can think of that you know how to extract... please feel free to contribute!
LOL - if five people have already listed
*.xz) CMD="tar -xf" ;; please refrain from adding a sixth!
