Ask Question
19 December, 15:19

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

+4
Answers (1)
  1. 19 December, 15:22
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers