aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnomsu8
1 files changed, 4 insertions, 4 deletions
diff --git a/nomsu b/nomsu
index dbeee11..6458c3c 100755
--- a/nomsu
+++ b/nomsu
@@ -1,15 +1,15 @@
#!/bin/bash
while getopts ':V:L' flag; do
case "${flag}" in
- V) VERSION="${OPTARG/./\.}\\b" ;;
+ V) VERSION=$OPTARG ;;
L) LIST="YES" ;;
esac
done
if [[ $VERSION ]]; then
- candidates=$(ls $(dirname $BASH_SOURCE) | grep "^nomsu$VERSION[0-9.]*$")
+ candidates=$(find $(dirname $BASH_SOURCE) -maxdepth 1 -name "nomsu$VERSION*")
else
- candidates=$(ls $(dirname $BASH_SOURCE) | grep "^nomsu[0-9.]\+$")
+ candidates=$(find $(dirname $BASH_SOURCE) -maxdepth 1 -name "nomsu[0-9]*")
fi
if [[ $LIST ]]; then
@@ -18,7 +18,7 @@ if [[ $LIST ]]; then
fi
if [[ $candidates ]]; then
- eval $(dirname $BASH_SOURCE)/$(echo "$candidates" | sort -V | tail -n 1) $@
+ "$(echo "$candidates" | sort -V | tail -n 1)" "$@"
else
echo "Failed to find a Nomsu version matching the regex: \"nomsu$VERSION\""
echo "The versions available are:"