So I need my while loop to continually loop but it stops after the first user's input, example:
[user]$: ./pleasefix.sh
Enter Input:test
test is writeable.
[user]$:
Heres my script as it is:
if [ "$#" -ne 0 ]
then
echo "$0" "is expecting no arguments; found $# $*"
echo "Usage: "$0""
exit 2
fi
while read -p "Enter Input:" userString
do
if [ -w "$userString" ]
then
echo ""$userString" is writeable."
exit 0
else
echo ""$userString" is nonexistent or not writeable."
exit 1
fi
done
What can I add to my while to make it actually loop and re prompt the user for another file name? Basically I want it to last forever until a EOF is sent (crtl + D)
exitcall exits the scriptecho ""$userString" is writeable."is very unusual quoting style. Eitherecho "$userString is writeable."orecho $userString is writeable.would be far more typical.