jeudi 12 janvier 2017

Random word Bash script if a number is supplied as the first command line argument then it will select from only words with that many characters.

I am trying to create a Bash script that - prints a random word - if a number is supplied as the first command line argument then it will select from only words with that many characters.

This is my go at the first section (print a random word):

C=$(sed -n "$RANDOM p" /usr/share/dict/words) echo $C

I am really stuck with the second section. Can anyone help?




Aucun commentaire:

Enregistrer un commentaire