Homework Help Question & Answers

Programs/scripts 13. Write a bash shell script that displays the date by using the shell command...

Programs/scripts 13. Write a bash shell script that displays the date by using the shell command date. 14. Write a command li

Programs/scripts 13. Write a bash shell script that displays the date by using the shell command date. 14. Write a command line program that takes a number and a command as arguments. Call that command that number of times. For example, if your program name is "test" test 3 dir <shows directory> dir <shows directory> dir <shows directory>
0 0
Add a comment
Answer #1

13)

The command is $date

Command execution screenshots:

R script.sh (-/Desktop) - gedit Open - save : script.shx date

ubu@ubuntu:-/Desktops bash script.sh Sat Feb 15 21:31:41 PST 2020 ubu@ubuntu:-/Desktop$ 1

14)

Shell script:

count="$1" #storing first parameter
cmd="$2" #storing second parameter
while [ $count -ne 0 ] #running in a loop
do
eval "$cmd" #executing the command
count=`expr $count - 1`
done

Screenshots:

O test.sh (-/Desktop) - gedit Open - Save Undo E test.sh count=$1 #storing first parameter cmd=$2 #storing second paramet

ubu@ubuntu:-/Desktop bash test.sh 3 date Sat Feb 15 21:55:29 PST 2020 Sat Feb 15 21:55:29 PST 2020 Sat Feb 15 21:55:30 PST 20

unixPasswd ubu@ubuntu:-/Desktop bash test.sh 3 dir 1.sh- files.tar Sample.txt test.sh compress.tar.gz hi script.sh- test.sh 1

Add a comment
Know the answer?
Add Answer to:
Programs/scripts 13. Write a bash shell script that displays the date by using the shell command...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coin

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a bash shell script to print the number of command line arguments and list of...

    Write a bash shell script to print the number of command line arguments and list of command line arguments 3. 12]

  • You are currently running/debugging a shell script program in the foreground that seems to be in an infinite loop, to terminate/kill the shell script program. 7. (type/enter - control C to send a &#3...

    You are currently running/debugging a shell script program in the foreground that seems to be in an infinite loop, to terminate/kill the shell script program. 7. (type/enter - control C to send a "program interrupt" ) or (contact the sysadmin person to kill your shell script program) 8. The UNIX/Linux exit command entered on the KORN shell command line will exit the shell session properly (best practice). [True / False] When killing a background process with the kill command you...

  • bash shell scripting help

    Create a bash shell script that will output the number of arguments passed on thecommand line. Name this script "count.sh"

  • Write a script using the bash shell to add new users to the system. The script...

    Write a script using the bash shell to add new users to the system. The script should read user information from a comma-delimited file (each field should be separated by a comma). The filename should be passed to the script as a command-line argument. Be sure the script contains a usage clause. The input file should contain the user information with one user per line. As the system administrator, you should determine the information necessary for each user to properly...

  • UNIX Write and run a simple shell script name mymenu that creates a simple command menu....

    UNIX Write and run a simple shell script name mymenu that creates a simple command menu. The script should present menu items (see below), prompts the user for a selection, and then executes the appropriate command selected. [Submit your script and the results of a test case for a, b, c, and d selections]     COMMAND MENU a. Current date and time b. Name of the working directory c. Contents of the working directory Enter a, b, or c:

  • Write a program in C or a script in bash, called “compare” that takes two numbers on the command line and compares them....

    Write a program in C or a script in bash, called “compare” that takes two numbers on the command line and compares them. The program should print the result of the comparison. Specifically, it should print “<x> is <comparison> <y>”, where <x> is the first number, <y> is the second number and <comparison> is one of “equal to”, “greater than” or “less than”. If the two numbers are equal, the program should have an exit status of zero. The exit...

  • Creating shell script and c++ program

    Part 1Create a shell script that returns a full name associated with a userid specified in the command line argument.Use the names found in /class/rolls/CSCE215-80[1-2].Your shell script should be named findName.shExample:$ ./findName.sh grabasanBILLY T GRABASANDWICH$Your shell script must either:Return the full name associated with the useridorReturn an error message if the command line arguments are not equal to 1.orReturn the message "Sorry that person is not in CSCE215-80[1-2]"No other output is acceptable.Part 2findName programCreate a C++ program that takes a...

  • Write a bash script to protect a directory. Your script should notify a user of the...

    Write a bash script to protect a directory. Your script should notify a user of the following: -New file was created -Permission changes -Ownership changes -File size changes -Modification date changes Your script should have two operation modes, protect and check. Use command line flags, -p <directory> and -c <directory> to decide which mode to operate in. In protect mode, your script should create a file called .protect inside the directory you want to watch. You will use this file...

  • Write a C shell script called canrun that displays the names of the files in the...

    Write a C shell script called canrun that displays the names of the files in the current directory that have execute permission set (permission being for the file owner) and how many of these files there are. For example, output from the script might look like: Executable files: canrun menunix showperm 3 files found

Free Homework App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.