Question

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

0 0
Add a comment Improve this question Transcribed image text
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 Coins

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 called direct.sh. This script will take an arbitrary number of command...

    Write a bash shell script called direct.sh. This script will take an arbitrary number of command line arguments. Your script should create directories starting with the first argument, then the second directory inside the first one, and then the next one inside the second one, and so on.

  • 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]

  • write the bash script Write a script compress_large_files.sh. This script accepts one or more command line...

    write the bash script Write a script compress_large_files.sh. This script accepts one or more command line arguments. The first argument has to be an integer; let’s call it size. If this is the only command line argument, compress_large_files.sh inspects all files in the current working directory and compresses every file of size at least size. If there is more than one command line argument, all arguments except the first one must be valid directories. In this case, compress_large_files.sh inspects the...

  • Write a script using simple shell commands. The script takes a command line argument that specifies...

    Write a script using simple shell commands. The script takes a command line argument that specifies a directory dir. The script first changes directory to dir, then prints the following in sequence: (a) A line starting “Current date and time: ”. Then on the same line, the current time and date. (b) A line starting “Current directory is : ”. Then, on the same line, the absolute pathname of the current working directory. (c) An empty line (d) The line...

  • NIT1202 Operating Systems UNIX Script You are required to write a Bourne Again Shell Script (bash)...

    NIT1202 Operating Systems UNIX Script You are required to write a Bourne Again Shell Script (bash) to manage a menu driven program. When executed the user should be presented with a menu with 4 (four) options: Print the following user information: the home directory, path, userid , login shell together with the current date and time. Ask a user a range and it displays eight random number between the range. [Range difference must be 100. Example Enter a range: 200...

  • 1. Write 4 simple shell scripts. Each question will ask you to write one or more...

    1. Write 4 simple shell scripts. Each question will ask you to write one or more command lines to solve a problem. Put the command(s) from each problem into a file named problem1.sh, problem2.sh Note that if you want your script to be interpreted by bash, each file should start with the line: #!/bin/bash and will have one (or more, as needed) commands following it. To execute each script in bash, so you can determine if it is working or...

  • 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...

  • Write a bash shell script to carry out each of the following tasks: What to Do:...

    Write a bash shell script to carry out each of the following tasks: What to Do: a. Safe Delete: When you use the “rm” command in Linux, it will delete the specified files, with no chance for recovering them back later. Write a script (called srm) that will safely delete the files passed to it as command-line arguments. For example, typing the command: “srm file1 file2 file3”, the script shall not actually delete these files, but instead it shall move...

  • This assignment will assess your ability to write bash scripts. Drop​ ​down​ ​to​ ​the​ ​root​ ​user​...

    This assignment will assess your ability to write bash scripts. Drop​ ​down​ ​to​ ​the​ ​root​ ​user​ ​using​ ​the​ ​command​ ​sudo su -.​ Write a bash script named /root/exam02.sh that does the following: Takes exactly 1 argument. If the number of arguments is not 1: Print "Exiting!" and exit with return code 40. If the number of arguments is exactly 1: Print the first argument as per the example below. Example output for your reference: The script should have the following...

ADVERTISEMENT
Free Homework Help 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.
ADVERTISEMENT
ADVERTISEMENT