Ask Question
12 February, 01:14

Create a script that internally calls the Linux command 'ps aux' and saves the output to a file named unprocessed. txt (you do not need to append to an existing file, if a file already exists, simply overwrite it). The program should pause and display the following message to the screen: Press 'q' to exit or 'ctrl-c' to process the file and exit' If the user presses 'q', exit the program leaving the filename on the disk as 'unprocessed. txt'. If the user presses 'ctrl-c', then catch the signal (hint - covered in chapter 16) and rename the file to 'processed. txt' and then exit. You must build a signal handler to catch the ctrl-c signal and rename the file. g

+3
Answers (1)
  1. 12 February, 05:05
    0
    see explaination

    Explanation:

    SIG{INT} = sub {

    'mv unprocessed. txt processed. txt';

    print "/n";

    exit;

    };

    'ps aux > unprocessed. txt';

    print "Press 'q' to exit or 'ctrl-c' to process the file and exit:/n";

    $inp =;

    if ($inp = = 'q')

    {

    exit;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Create a script that internally calls the Linux command 'ps aux' and saves the output to a file named unprocessed. txt (you do not need to ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers