12345678910111213141516171819202122232425262728 |
- #!/usr/bin/env bash
- set -Eeuxo pipefail
- # current script directory
- DIR="$(cd "$(dirname "$0")" > /dev/null 2>&1; pwd -P)"
- printf "script directory: %s\n" "${DIR}"
- if [ -z ${1+x} ]; then
- printf "%s\n" "No log file specified.";
- exit 1;
- else
- printf "%s %s %s\n" '${1}' 'is set to' "${1}";
- COMPRESSED_LOG_FILE="${1}"
- fi
- COMPRESSED_FILE_NAME="$(basename -- ${COMPRESSED_LOG_FILE})"
- # DECOMPRESSED_FILE_NAME=$(echo "${COMPRESSED_FILE_NAME}" | rev | cut --fields '2-' --delimiter '.' | rev)
- DECOMPRESSED_FILE_NAME="${COMPRESSED_FILE_NAME%.*}"
- cp --verbose "${COMPRESSED_LOG_FILE}" "${DIR}/${COMPRESSED_FILE_NAME}"
- # z8qdlxa1c3bjdcx91p200vgxdkwfyg-python-jupyterlab-server-2.0.0rc1.drv.bz2 ->
- # z8qdlxa1c3bjdcx91p200vgxdkwfyg-python-jupyterlab-server-2.0.0rc1.drv
- bzip2 --decompress "${COMPRESSED_FILE_NAME}"
- cat "${DECOMPRESSED_FILE_NAME}"
- rm --verbose "${DECOMPRESSED_FILE_NAME}"
|