From b0e98bad0a7f5b80f3f79b1ce4757c3cae4f00f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Tue, 20 May 2025 04:24:17 +0800 Subject: [PATCH] Added type for pwgen --- bash/sources/12_shortcuts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bash/sources/12_shortcuts b/bash/sources/12_shortcuts index 16c69b7..f081cc4 100755 --- a/bash/sources/12_shortcuts +++ b/bash/sources/12_shortcuts @@ -19,14 +19,21 @@ function kres { } function pwgen { - local _LEN=$1 + local _LEN=$1 _TYPE=$2 case $_LEN in - ''|*[!0-9]*) + *[!0-9]*) echo "Enter a valid number" > /dev/stderr return 1 ;; + '') + echo "Usage: pwgen [LEN] [TYPE]" + return 1 + ;; esac - LC_ALL=C tr -dc '[:graph:]'