Skip to content

Commit

Permalink
drop dirname in favor of native Bash strings
Browse files Browse the repository at this point in the history
Convert `var=${dirname $filename)` to `var="${filename%/*}`, everywhere except *plugin/z_autoenv*.
  • Loading branch information
gaelicWizard committed Mar 5, 2022
1 parent 7d84283 commit 1c780bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/available/extract.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ End-Of-Usage
continue
fi

local -r filename=$(basename -- $1)
local -r filedirname=$(dirname -- $1)
local -r filename=${1##*/}
local -r filedirname=${1%/*}
local targetdirname=$(sed 's/\(\.tar\.bz2$\|\.tbz$\|\.tbz2$\|\.tar\.gz$\|\.tgz$\|\.tar$\|\.tar\.xz$\|\.txz$\|\.tar\.Z$\|\.7z$\|\.nupkg$\|\.zip$\|\.war$\|\.jar$\)//g' <<< $filename)
if [ "$filename" = "$targetdirname" ]; then
# archive type either not supported or it doesn't need dir creation
Expand Down

0 comments on commit 1c780bb

Please sign in to comment.