Question

In UNIX .Write a bash script that takes a list of usernames as its command line...

In UNIX .Write a bash script that takes a list of usernames as its command line arguments and displays on the screen, for each user name, a message of the form Number of times that logged into this machine is where is to be replaced by the number of recors that the last command output that match exactly. For example, if i enter command logincount mark it should output something like number of times that sweiss logged into this machin is 7. If a name given as an argument is not a username, nothing is printed for that name. On the other hand, if no names are given, it is an error and the command should display the error message, " Usage: logincount "

Homework Answers

Answer #1

I have attached the output after the code image.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Question I This question carries 20% of the marks for this assignment. You are asked to...
Question I This question carries 20% of the marks for this assignment. You are asked to develop a set of bash shell script: Write a script that asks for the user's salary per month. If it is less or equals to 800, print a message saying that you need to get another job to increase your income, what you earn is the Minim living cost. If the user's salary is higher than 800 and below 2000, print a message telling...
The first script you need to write is login.sh, a simple script that you might run...
The first script you need to write is login.sh, a simple script that you might run when you first log in to a machine. We'll expand this script later, but for now it should include your name, username, hostname, current directory, and the current time. Here is some sample output to help guide you. Note that the bolded lines that start with "[user@localhost ~]$" are the terminal prompts where you type in a command, not part of the script. Of...
UNIX COMMANDS Task B Create a one-line command, using the famous.dat file, to add the word...
UNIX COMMANDS Task B Create a one-line command, using the famous.dat file, to add the word " STREET" to the address, for all who live on 2nd or 3rd. For example: "2nd" becomes "2nd STREET" and "3rd" becomes "3rd STREET". Display only the first 9 lines. Hint: Use 2 sed statements with pipes. Task C Display all lines in famous.dat that end in 0 or 1, and have a 1 in the 3rd from the last column. For example lines...
write a script named print_lines.sh that uses head and tail together to print out a specific...
write a script named print_lines.sh that uses head and tail together to print out a specific set of lines from a file. The script should take three arguments: the line number to start at, the line number to stop at, and the file to use. Here's an example run: [user@localhost ~]$ print_lines.sh 7 10 /etc/passwd shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin [user@localhost ~]$ In this example, the script prints line 7 through 10 (inclusive) of the /etc/passwd file. Your script must do...
Write UNIX commands to perform the following tasks. Each task must use exactly one line of...
Write UNIX commands to perform the following tasks. Each task must use exactly one line of command. Unless stated otherwise, all files are assumed to be at your current working directory. a) (10 points) Print your current working directory into a file named file1 b) (10 points) Assume that your current working directory is NOT the same as your home directory. Print all file and subdirectory names of your home directory into a file named file2. c) (15 points) Copy...
C LANGUAGE CODE WITH COMMAND-LINE ARGUMENTS (NO SCANF TO BE USED ) Q]. Write a program...
C LANGUAGE CODE WITH COMMAND-LINE ARGUMENTS (NO SCANF TO BE USED ) Q]. Write a program that displays all the prime numbers in the given array with the following constraint. Constraint: Only those prime numbers should be displayed whose location is a composite number. Although you may have several prime numbers in the array, only those prime numbers should be displayed which are stored at non-prime locations. Remember that the first position in an array corresponds to the location/index 0....
Bash script with branching and looping Part 1: 1. Create a variable called NAME and set...
Bash script with branching and looping Part 1: 1. Create a variable called NAME and set it equal to the empty string (NAME=””). Create a variable called NAME_LENGTH and set it equal to the length of your last name. Output the value of the NAME variable to show that it is empty. 2. Write a FOR loop that executes as many times as there are letters in your name (use the NAME_LENGTH variable in your condition). Use a CASE statement...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all...
Python: Simple Banking Application Project Solution: • Input file: The program starts with reading in all user information from a given input file. The input file contains information of a user in following order: username, first name, last name, password, account number and account balance. Information is separated with ‘|’. o username is a unique information, so no two users will have same username. Sample input file: Username eaglebank has password 123456, account number of BB12 and balance of $1000....
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
This is a Java program Program Description You work for a local cell phone company and...
This is a Java program Program Description You work for a local cell phone company and have been asked to write a program to calculate the price of a cell phone data plan being purchased by a customer. The program should do the following tasks: Display a menu of the data plans that are available to be purchased. Read in the user’s selection from the menu.  Input Validation: If the user enters an invalid option, the program should display an error...