Skip to content

Commit 93adc85

Browse files
committed
Improve input detection for programs
Before it was accepting 'PIP' for example as a valid program
1 parent 656266c commit 93adc85

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bin/Alien

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ fi
2828

2929
mode="$1"
3030
prog="$2"
31-
alientype="${prog%%:*}"
32-
alienpkg="${prog#*:}"
33-
if [[ -z "$alientype" || -z "$alienpkg" ]]
31+
if [[ ! $prog =~ ^.+:.+$ ]]
3432
then
35-
echo "Error: missing program name"
33+
echo "Error: missing program name, format shoud be 'AlienType:program'"
3634
exit 1
3735
fi
36+
alientype="${prog%%:*}"
37+
alienpkg="${prog#*:}"
3838
shift 2
3939
exec Alien-$alientype $mode $alienpkg "$@"

0 commit comments

Comments
 (0)