randpw should take an argument, too

This commit is contained in:
Rico Ullmann 2016-04-24 15:01:12 +02:00
parent 99ee47daf6
commit 1f1b4041cf
1 changed files with 13 additions and 1 deletions

View File

@ -61,5 +61,17 @@ function nsgrep --description 'show open ports for $argv'
end
function randpw --description 'generate a password'
tr -dc 'a-zA-Z0-9_@#%&,;()-' < /dev/urandom | head -c32;echo;
switch (count $argv)
case 0
tr -dc 'a-zA-Z0-9_@#%&,;()-' < /dev/urandom | head -c32;echo;
case 1
tr -dc 'a-zA-Z0-9_@#%&,;()-' < /dev/urandom | head -c$argv;echo;
case \*
echo "Only none or 1 arguemnt is valid!"
return 1
end
end