Q1. Merge and sort the contents of files a,b,c and display the sorted ...

1 downloads 118 Views 15KB Size Report
Write a shell script which gets executed, it should display the message “good morning”/”good evening”/”good af
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING MOTILAL NEHRU NATIONAL INSTITUTE OF TECHNOLOGY ASSIGNMENT -7 SUB: UNIX & Shell Programming

CLASS: B.TECH (IV SEM ) IT1

Q1. Merge and sort the contents of files a,b,c and display the sorted output and save the uniq contents in another file d.

Q2. Add two nos. given by command line arguments and if this two nos. are not given then show some error message.

Q3. Write Script to find out biggest number from given three nos. Nos are supplies as command line argument. Print error if sufficient arguments are not supplied.

Q4. Write a shell script which gets executed, it should display the message “good morning”/”good evening”/”good afternoon” depending upon the time the program got executed.

Q5. Write script to print contains of file from given line number to next given number of lines. For e.g. If we called this script as a.sh and run as $sh a.sh 5 5 myf , Here print contains of 'myf' file from line number 5 to next 5 line of that file.

Q6. Write a script that presents a multiple choice questions, get user answers and report back total no of corrects.

Q7. Write script, that receive an argument "one" ,"two" , "three" .if argument supplied is "one" then display in bold , if "two" then as Blink effect, display in reverse if it is "three" . for others display it in red color .using else-if statement and switch case .

Read all concepts clearly w.r.t to syntax, this is revised lab

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING MOTILAL NEHRU NATIONAL INSTITUTE OF TECHNOLOGY ASSIGNMENT -7 SUB: UNIX & Shell Programming

CLASS: B.TECH (IV SEM ) IT1

Q8. Write a Shell Script which creates the following menu and prompts for choice from user and runs the chosen command. Today's date Process of user List of files Quit to UNIX

Q9. Write a Shell Script that computes the factorial of a given number.

Q10. Write a Shell Script that changes the extension of a group of files from txt to doc

Q11. Calculate the smallest number and largest number among a set.

Q12. Write a Shell Script which will redirect the output of the date command without the time into a file.

Q13. Write a Shell Script which takes a command line argument of Kms and by default converts that number into meters. Also provide options to convert km to dm and km to cm.

Q14. WAP to calculate and print the first m Fibonacci numbers. Q15. WASS that will receive any number of filenames as arguments. The shell script should check whether such files already exist. If they do, then it should be reported. The files that do not exist should be created in a subdirectory called mydir. The shell script should first check whether the sub-directory mydir exists in the current directory. If it doesn’t exist, then it should be created. If mydir already exists, then it should be reported along with the number of files that are currently present in mydir.

Read all concepts clearly w.r.t to syntax, this is revised lab