Hi there,
im having issue with comparing two variables, in a bash script.
im trying to do the following:
- get a word from user 1
- split the word into array
- get a character from user2
trying to compare the character entered by user 2 with every single character in the array entered by user1. here is the code:
#######################################
echo "$name1 Enter a word: "
read word
wordarray=(`echo $word | sed 's/./& /g'`) # i used sed to convert it to
# array
echo "$name2 enter a character: "
read guess
guessarray'('echo $guess | sed 's/./&/g'`) # convert the user2 entry to character
#####################################
and then from here, im having trouble finding a way to compare the entry of user2 with every single item in the array entered by user1.
Thanks in advance.