1#!/usr/local/bin/bash 2 3usage(){ 4echo " 5Written by Brian Bushnell 6Last modified April 25, 2019 7 8Description: Compresses or decompresses files based on extensions. 9This only exists because the syntax and default behavior of many 10compression utilities is unintuitive; it is just a wrapper, and 11relies on existing executables in the command line (pigz, lbzip, etc.) 12Does not delete the input file. 13Does not untar files. 14 15Usage: unzip.sh in=<file> out=<file> 16 17Parameters: 18in=<file> Input file. 19out=<file> Output file for good reads. 20zl= Set the compression level; 0-9 or 11. 21 22Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems. 23" 24} 25 26#This block allows symlinked shellscripts to correctly set classpath. 27pushd . > /dev/null 28DIR="${BASH_SOURCE[0]}" 29while [ -h "$DIR" ]; do 30 cd "$(dirname "$DIR")" 31 DIR="$(readlink "$(basename "$DIR")")" 32done 33cd "$(dirname "$DIR")" 34DIR="$(pwd)/" 35popd > /dev/null 36 37#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" 38CP="$DIR""current/" 39 40z="-Xmx80m" 41set=0 42 43if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then 44 usage 45 exit 46fi 47 48calcXmx () { 49 source "$DIR""/calcmem.sh" 50 setEnvironment 51 parseXmx "$@" 52} 53calcXmx "$@" 54 55unzip() { 56 local CMD="java $EA $EOOM $z -cp $CP jgi.Unzip $@" 57# echo $CMD >&2 58 eval $CMD 59} 60 61unzip "$@" 62