Q2) Write a shell script program to read a number then checks the number using the following:
If the number is =100 print (number is equal to 100)
If the number is>100 print( number is less than 100)
If the number is<100 print( number is greater than 100)
vi editor code in shell script.
![echo Enter a number read >x if [ $x -eq 100 ] then echo number is equal to 100 elif I $x -1t 100 ] then echo number is l](http://img.homeworklib.com/questions/c1c6c070-369c-11eb-92b9-915bfd24382a.png?x-oss-process=image/resize,w_560)
Output
![[root@loc alhost ~]# ./file.sh Enter a number 20 number is less than 100 [root@loc alhost ~]# ./file.sh Enter a number 100 nu](http://img.homeworklib.com/questions/c3795410-369c-11eb-85e7-a514ebe16bcf.png?x-oss-process=image/resize,w_560)
Q2) Write a shell script program to read a number then checks the number using the...
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...
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>
lab software
using
cygwin
part1
part2
1 of 1 1. Write a shell program name it "lab4q1.sh" to compare the two strings: a. Read the first string. b. Read the second string. c. If the strings are empty print "String Empty" and exit using the statement exit 1. d. Compare the two strings using the if and print longer string. e. If the size of both strings is same, then print that two strings are equal (use printf), otherwise, print...
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...
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...
Homework No.2 CSC 222 Write a shell script program called "countf.sh" that will count how many files or directories recursively. beside the file counts, also report how many files for each types (directory or regular files). It will either take arguments for specific directories and no argument. If no argument, it will read the current working directory as the starting point. Please also provide -h option to print out how to use your countf.sh program % ./countf.sh % ./countf.sh file1...
Write a Unix Shell Script to print all Armstrong Numbers between 1 and 1000. Your Program should include following key points: Program should have Header Comments. Program should print all Armstrong numbers between 1 and 1000: 1 153 370 371 407
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 print the number of command line arguments and list of command line arguments 3. 12]
Unix code problem Write a shell script that does the following : Read many lines of text from the standard input device (keyboard) and copy them to the standard output. Precede each output line with a line number Explain all steps