x

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 779a1f639ad0ad6ae40e0dff4c6f6303e57bc796
parent bea39a13a6ddeb4c08e10827d5577bf0c762cc23
Author: Michael Constantine Dimopoulos <31562759+MichaelDim02@users.noreply.github.com>
Date:   Wed, 21 Jul 2021 01:30:15 +0000

Updated x.sh

Better way of getting the extension.
Before, the extension of file.txt.gzip would be tzxt.gzip which is wrong. Now it reverses the string and gets the first field, so it will get gzip, which is correct.
Diffstat:
Mx.sh | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/x.sh b/x.sh @@ -5,8 +5,8 @@ # Website: https://mcdim.xyz # Email: mk@mcdim.xyz -ext=$( echo $1 | cut -d . -f2- ) -bn=$( echo $1 | cut -d . -f1 ) +ext=$( echo $1 | rev | cut -d . -f1 | rev ) +bn=$( echo $1 | rev | cut -d . -f2- | rev ) if [ "$ext" = "zip" ]; then unzip "$1"; elif [ "$ext" = "gz" ]; then gzip -d "$1";