Question: For the given, cmd1 and cmd2 are arbitrary UNIX commands, and file1 and file2 are files owned by you. Write UNIX (bash) commands to:
a) Run cmd1 and append its output to file1.
b) Run cmd1, and if it returns a status of 0, run cmd2.
c) Run cmd1 and redirect both standard output and standard error to file1.
d) Compare file1 and file2 (as text files).
e) Run cmd1 passing the names of all files in the present directory as arguments.
f) Replace file1 with the output of cmd1.
g) Sort file1 and store the result in the file2.
h) Run cmd1 in the background at low priority.
i) Set the environment variable $FOO to ‘Hello’.
j) Set permissions so that anyone might execute file1.
k) Set permissions on file1 and file2 so that anybody can read them however only you can edit them.
l) Set permissions on dir1 so that anyone might list the files in it, or read or execute such files, however only you can add or remove the files.
m) Kill the process with process ID 12345.
n) Show what background processes are presently running.
o) Show that the owners and permissions for file1and file2.
p) Print all lines in file1 having “foo”.