Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

task6 Write a bash script accepting three arguments: (stdout file), (stderr file), and (cwd), followed by an arbitrary number of other ar- guments specifying a

image text in transcribed
task6 Write a bash script accepting three arguments: (stdout file), (stderr file), and (cwd), followed by an arbitrary number of other ar- guments specifying a subcommand and its arguments. The script will run the specified subcommand with all the specified arguments, redirecting the subcommand's stdout to (stdout file) and the subcommand's stderr to stderr file), and setting the subcommand's current working directory to (cwd) For instance, if the script is invoked in the following way: /script.sh /tmp/stdout /tmp/stderr /bin ls -1 -a the command 1s will be run with the arguments -1 and -a. When run, ls's current working directory must be /bin, the stdout output must be saved in (stdout file), and the stderr output must be saved in (stderr file) The script must not change its own current working directory. The script should print to stdout the erit code of the executed subcommand. Nothing else should be print to stdout or stderr To refer to all the arguments specified by the user after the argument cud), I suggest using the bash array variable "$Q: (n))" (substituting (n) with a proper number). I suggest using a subshell not to change the script (cwd) https://en.wikipedia.org/wiki/Unix_time https://www.tldp.org/LDP/abs/html/subshells.html

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions