Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

Write the Roman numeral as a HinduArabic numeral. CXLII

Answered: 1 week ago