- Questions & Answers
- Get Coins
The command is $date
Command execution screenshots:
count="$1" #storing first parameter
cmd="$2" #storing second parameter
while [ $count -ne 0 ] #running in a loop
eval "$cmd" #executing the command
count=`expr $count - 1`
Programs/scripts 13. Write a bash shell script that displays the date by using the shell command...
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 "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...
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 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. 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. 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...
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 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 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