Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In bash, I want the user to enter four sentences then I want to print out the longest sentence they entered. I was trying to
In bash, I want the user to enter four sentences then I want to print out the longest sentence they entered. I was trying to put each sentence into a list and print out longest element , but this doesn't work.
1 #1/usr/bin/env bash 2 listofLines-( 3 echo "Enter four lines of input: 7 while read lines 9 listofLines+-(Slines) echo $lines >> mylines.txt 1 done 12 13 max=$(listofLines(e)) 14 for n in "S(listofLinesto)" do [[ Sn > Smax ]] && max=Sn 16 done on17 echo SmaxStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started