sh

ConorDoesItAll

·

printWordsNoLetters.sh

·

SH

·

Total Size: 260 B

·

·

Created: 6 months ago

·

Edited: 6 months ago

#!/usr/bin/env bash #Script using egrep to print random words with the user chosen amount of letters WordFile=./text.txt echo How many letters should the outputed word/words have? read noLetters grep -E -w '^[[:alpha:]]{$noLetters}' $WordFiles echo noLetters

3 bits

147 views

Are you sure you want to delete?

User Profile Picture

This is cool!

ConorDoesItAll

14-04-2019 15:57:23

Thank you. It's very basic I'm currently learning Bash!

dan

14-04-2019 16:00:35

Thank you ConorDoesItAll, very cool!

embluk

14-04-2019 16:09:12

Hopefully CodeClippet is useful for you! :)

User Profile Picture

When I run the script grep does not return anything. Any ideas? I can substitute '$noLetters' for a value such as '4' and it will work.