June 2017
Beginner
502 pages
11h 26m
English
We just saw some interesting comparisons, but now things start to become more interesting because we are going to introduce some tests on strings, and this brings us a step forward in what we can do to make our scripts more reactive:
#!/bin/bash echo "Hello user, please type a string and press enter:"read user_input1 echo "Now type another string and press enter:"read user_input2 if [ ${user_input1} = ${user_input2} ]thenecho "Great! The string ${user_input1} is equal to ${user_input2}"elseecho "The string ${user_input1} is not equal to ${user_input2}..."fi
And now some tests:
zarrelli:~$ ./equal.sh Hello user, please type a string and press enter:hello
Read now
Unlock full access