pm3: textual and --list with no device, exit 1

This commit is contained in:
Philippe Teuwen 2020-05-17 12:06:39 +02:00
commit be1659b1bf

8
pm3
View file

@ -338,7 +338,7 @@ done
if [ "$1" == "--list" ]; then
shift
if [ "$1" != "" ]; then
echo "Option --list must be used alone"
echo "[!!] Option --list must be used alone"
exit 1
fi
SHOWLIST=true
@ -352,7 +352,7 @@ if [ "$1" == "-n" ]; then
N=$1
shift
else
echo "Option -n requires a number between 1 and 9, got \"$1\""
echo "[!!] Option -n requires a number between 1 and 9, got \"$1\""
exit 1
fi
fi
@ -363,7 +363,7 @@ if [ "$HOSTOS" = "LINUX" ]; then
# Test presence of wmic
wmic.exe computersystem get name >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "[!] Cannot run wmic.exe, are you sure your WSL is authorized to run Windows processes? (cf WSL interop flag)"
echo "[!!] Cannot run wmic.exe, are you sure your WSL is authorized to run Windows processes? (cf WSL interop flag)"
exit 1
fi
GETPM3LIST=get_pm3_list_WSL
@ -384,7 +384,7 @@ if $SHOWLIST; then
$GETPM3LIST 9
if [ ${#PM3LIST} -lt 1 ]; then
echo "[!!] No port found"
exit 0
exit 1
fi
n=1
for DEV in ${PM3LIST[@]}