Answered step by step
Verified Expert Solution
Question
1 Approved Answer
BASH SCRIPT Write a shell script which reads text from the user into variables. Echo each word on a separate line. The shell will automatically
BASH SCRIPT
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 * echo "File $a_file" done Again, for each file: Filename Size in Kilobytes Size in BytesStep 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