• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick bourne scripting question

I donno.

Maybe you misunderstood the task.
Maybe it was 'wait for user input then check to see the number of agruments', rather then check the actual user input you were waiting on.

Anyways, I think the trouble with your script there is that your using the string input rather then the variable input.
Try
for thing in $input


Also I think it's ((count++)) for doing that sort of thing, but I am not sure. don't do math in bash very much.

edit:
oh, and no spaces in the variable assignment.
count=0
not
count = 0
 
Well sure.

It's obvious that his script was never intented to check the input of the user when replying. It only checks what they stuck on the command line.

So somebody is confused somewere. It's just as likely might be him. I don't know.

I've corrected teachers a few times..
 
Your solution is correct, according to the original post. You could also simply do numbercount=`echo $numbers | wc -w` instead of the loop, but its all the same. It looks like your teacher combined two different tasks, argument parsing and user input.
 
Back
Top