Home / Expert Answers / Computer Science / unix-programming-will-leave-thumbs-up-20-points-we-want-a-bash-script-which-will-take-a-lis-pa531

(Solved): UNIX PROGRAMMING. WILL LEAVE THUMBS UP :) (20 points) We want a Bash script which will take a lis ...



UNIX PROGRAMMING. WILL LEAVE THUMBS UP :)

(20 points) We want a Bash script which will take a list of filenames on the command line and print out how many lines are in

(20 points) We want a Bash script which will take a list of filenames on the command line and print out how many lines are in each file. For each of the following scripts, indicate whether it works. If it does not, show how to fix i by changing the fewest characters possible. (Note: output format is not important.) Script A Works as is. Needs fixing. \#! /bin/bash for file in do wc -l file done Script B Works as is. Needs fixing. \#! /bin/bash for file in do echo -n "\$file " grep -c, , \$file done Script C Works as is. Needs fixing. \#! /bin/bash for file in * do echo -n "\$file " tr -dc ' ' file | wc done Script D Works as is. Needs fixing. bin/bash for file in do echo -n "\$file " awk 'END \{ print NR \}' \$file done


We have an Answer from Expert

View Expert Answer

Expert Answer



Script A: Needs fixing.

The variable file should be enclosed in double quotes ("$file") to handle filenames with spaces or special characters correctly.
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe