Skip to content

Commit

Permalink
Fix for macOS
Browse files Browse the repository at this point in the history
macOS uses bash 3.2 and the a[-1] feature
to access the last element of an array was added
on bash 4.1.

Check https://unix.stackexchange.com/a/198788
for more details.
  • Loading branch information
glumia committed Sep 14, 2020
1 parent 560063b commit cd2c4cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bash-tiasft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Author: Giuseppe Lumia (glumia@protonmail.com)
#
# v0.1.0
# v0.1.1
#

# General Usage:
Expand All @@ -31,7 +31,7 @@ function search_alias {
shortcut=""
while [[ -z "$shortcut" && -n "${cmd[*]}" ]]; do
shortcut=$(alias | grep "[^=]*[\"\']${cmd[*]}[\'\"]")
unset cmd[-1]
unset cmd[${#cmd[@]}-1]
done
if [[ -n "$shortcut" ]]; then
echo "There is a shortcut for that!"
Expand Down

0 comments on commit cd2c4cd

Please sign in to comment.