#!/bin/bash # # Read a reply from the user, then check it's not zero length # read -r -p "Please enter a string: " reply if [[ ${#reply} -eq 0 ]]; then echo "Please provide a non-empty reply" else echo "You said: $reply" fi # # Read a reply from the user, then check it's not zero length # read -r -p "Please enter a string: " reply if [[ -z $reply ]]; then echo "Please provide a non-empty reply" else echo "You said: $reply" fi