Bash - check for spaces

Hello, how can i repeat an dialog until  there are no spaces in the word that is read from the dialog ?

   dialog --title "EvoPanel - getmuh v1.5" \
          --inputbox "\nWrite the nickname\n" 13 50 "$jnickname"
   jnickname=`cat $tempfile`

while -nickname has spaces in it-; do something

so if i write "    blah" the while will turn on and ask me again, until i remove the spaces
Who is Participating?
ozoConnect With a Mentor Commented:
echo "$jnickname" | grep ' '
while echo $jnickname | grep ' '
rares_dumitrescuAuthor Commented:
while [ -z $jnickname ] || [ echo $jnickname | grep ' ' ]; do
cat /dev/null > $tempfile
   dialog --title "EvoPanel - getmuh v1.5" \
          --inputbox "\nError: You cannot have a null nickname.\n\
Please try again.\n" 12 50 "$jnickname"
   jnickname=`cat $tempfile`


but it does not say anything .. it forks if i type: aa aa
rares_dumitrescuAuthor Commented:
i was wrong, if i type aa aa it does not work, but if i tipe <space><space>aa it works, or aa<space><space>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.