Question: Write a shell script which reads text from the user into variables. Echo each word on a separate line. The shell will automatically tokenize (convert

 Write a shell script which reads text from the user into

Write a shell script which reads text from the user into variables. Echo each word on a separate line. The shell will automatically tokenize (convert to separate words) unquoted strings. Something like "for word in $string" will split up $string into separate words. I would also like to see you running programs in subshells and capturing the output. This involves using the backquote (under-, upper left of your keyboard). Strings in those quotes will be treated as command lines and run. The output of the command will be the value of the expression, so you can assign it to a variable. So, as a completely arbitrary task, for each file in the current directory, run "wc" to obtain the byte count for the file, and run "Is" to get the size in kilobytes. Print both out for comparison. I don't care what the exact format is as long as the filename, byte count, and size in kilobytes is shown for each file. Hint: The shell's globbing feature combined with a for loop would be a good choice for this assignment. Try out the following command: for a_file in do echo "File $a_file" done Again, for each file: Filename Size in Kilobytes Size in Bytes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!