Ask Question
8 November, 12:43

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

+2
Answers (1)
  1. 8 November, 14:33
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers