How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Mr. Gregory White Your Own Question
Mr. Gregory White
Mr. Gregory White, Professor
Category: Homework
Satisfied Customers: 5240
Experience:  M.A., M.S. Education / Educational Administration
Type Your Homework Question Here...
Mr. Gregory White is online now
A new question is answered every 9 seconds

You have helped me before, can you help me with a few unix

Customer Question

You have helped me before, can you help me with a few unix scripts now? I have a few of tuem to be written and need them by monday. There are about 5 different unix and perl scripts. I am not sure how much i should pay for somethig like this but if i get themto you can you get me a quote?
Submitted: 1 year ago.
Category: Homework
Expert:  Mr. Gregory White replied 1 year ago.

You need to spend $3 to view this post. Add Funds to your account and buy credits.
Customer: replied 1 year ago.

To become familiar with Perl programs and to see how to interact with the operating system, write a Perl program that performs the following tasks:

  • Generate a menu to ask the user for the task that he or she would like to see performed.

  • The available tasks are as follows:

    • Show current date and time.

    • Show users currently logged in.

    • Show the name of the working directory.

    • Show the contents of the working directory.

  • Prompt the user for the choice, and perform the system command.

You now need to write a script for user maintenance. Write a script that will perform the following tasks:

  • Prompt the system administrator for all valid input parameters

  • Generate a menu to ask which task is needed to be performed

  • Create a UNIX group

  • Drop a UNIX group

  • Create a user

  • Drop a user

Note that as part of the Create User section, a UNIX group many be identified that does not already exist, so that group will need to be created as part of the process.

A third script that you need to write will kill all of the processes associated with a user. The following are the requirements:

  • Prompt the system administrator for the target user name

  • List the running processes for that user

  • Confirm with the system administrator before killing the processes

  • Kill the processes after confirmation

It is very important to note with this task that you should only kill processes for a user and his or her running processes; do not arbitrarily kill running daemons.

Add to your Perl script the ability to kill a user’s processes (from shell script 3). The requirements for this task include the following:

  • Add this option to the menu.

  • Add the code/process into a subroutine.

  • Use an array to store the list of processes that need to be reviewed and killed.

  • Process the kill using the array.

Next, you have been asked by different users to explain how to compile a program in a UNIX environment.

Finally, take the following C program (save it as "power2.c"), and create it as a file in your UNIX environment:

/* power2.c -- Print out powers of 2: 1, 2, 4, 8, .. up to 2^N */

#include <stdio.h>
#define N 16

int main(void) {
int n; /* The current exponent */
int val = 1; /* The current power of 2 */
printf("/t n /t 2^n/n");
for (n=0; n<=N; n++) {
printf("/t%3d /t %6d/n", n, val);
val = 2*val;
return 0;
/* It prints out :
n 2^n
0 1
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1024
11 2048
12 4096
13 8196
14 16384
15 32768
16 65536

(College of Science and Technology, n.d.)

Describe the behavior when you compile the program, with no options. What is the command that you would use to compile the code and create the executable "power2"?

Finally, compare and contrast the usage of a compiled and interpreted program.