mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2025-10-07 07:22:36 +02:00
Fix: Replace bashism with POSIX-compliant pattern matching
Replaced the bash specific conditional [[ $base" == .* ]] with a case statement. Not sure why my first commit ran on my machine without error.
This commit is contained in:
parent
7f2211a921
commit
71500c1699
@ -10,10 +10,9 @@
|
||||
[ -z "$1" ] && echo "usage: rotdir regex 2>&1" && exit 1
|
||||
base="$(basename "$1")"
|
||||
|
||||
if [[ "$base" == .* ]]; then
|
||||
ls_opt="ls -a"
|
||||
else
|
||||
ls_opt="ls"
|
||||
fi
|
||||
case "$base" in
|
||||
.*) ls_opt="ls -a" ;;
|
||||
*) ls_opt="ls" ;;
|
||||
esac
|
||||
|
||||
$ls_opt "$PWD" | awk -v BASE="$base" 'BEGIN { lines = ""; m = 0; } { if ($0 == BASE) { m = 1; } } { if (!m) { if (lines) { lines = lines"\n"; } lines = lines""$0; } else { print $0; } } END { print lines; }'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user