Homework


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Homework
# 1  
Old 07-27-2011
Question Homework

1. Write a shell script to print the file names of all files having .txt extension of a given directory after converting to uppercase letters. The input (directory name) should be given as command line argument. The script will also check whether sufficient arguments are passed or not and whether the argument is a directory or not. In case of invalid input, proper message should be displayed.

2. Write a script that would print any one of the following message along with the username according to the system time:
Good Morning, between 12 AM and 12 PM.
Good Afternoon, between 12PM and 4 PM
Good Evening, after 4 PM

3. Write a shell script - compare.sh
It will take two string arguments from the user, compare them and give the output “Both are same” or “Both are different” based on whether they are same or not. If input string is null, error message should be given.
If user enters less or more number of arguments, an error should be thrown

4. Write a script which accept a number from command line and check whether it is prime or not. If it is prime number then store this number into prime.txt file otherwise store into notprime.txt file.
If user enters less or more number of arguments, an error should be thrown.

5. Write a shell script - reverse.sh
It will take a line as argument from the user, and display it in reverse order. If input string is null, error message should be given.
If user enters less or more number of arguments, an error should be thrown

Ex :
Input : This is Unix.
Output : Unix is This.

6. Write a shell script that prints the total number of users having a given file in their home directory. The input filename should be supplied as command line argument.

7. Write a shell script to count the frequency of semi colons(Smilie in a given file. The input file should be given as command line argument. The script will check whether sufficient arguments are there or not and whether the argument is a file or not while the script is executed. In case of invalid input , proper message should be displayed.

8. Use awk for displaying first n numbers in Fibonacci series where n is supplied as command line argument.
Note: Fibonacci series of numbers are 0 and 1, and each remaining number is the sum of the previous two. For e.g. first 5 numbers in Fibonacci series are 0, 1, 1, 2, 3

9. Write a shell script to display the four letter words in a given file. The script will also print the count of such words. The input file should be given as command line argument. The script will check whether sufficient arguments are there or not and whether the argument is a file or not while the script is executed. In case of invalid input, proper message should be displayed.
NOTE: The output should display the word only once although it may occur in the file more than once. Total count should be also the count of the distinct words.

e.g If the content of the given file is as folows----------------
There are three bags.
This is a blue bag.
My blue bags are full.

The output should be as----------------------
bags
This
blue
full
Count of four letter words is: 4

10. Write a shell script to display the longest line in a given file. It will also display the number of words in that line. The input file should be given as command line argument. The script will check whether sufficient arguments are there or not and whether the argument is a file or not while the script is executed. In case of invalid input, proper message should be displayed.
These 4 Users Gave Thanks to aninda1989 For This Post:
# 2  
Old 07-27-2011
This User Gave Thanks to Shell_Life For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Homework Help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: Write a command to display lines ending with the... (1 Reply)
Discussion started by: elh009
1 Replies

2. Homework & Coursework Questions

Homework

plz i need code to search about numbers like this : 962785785698 962795565488 962785321565 962777321684 962795979515 i need code to detect just numbers start with "96278" i need it in awk !! thanks (1 Reply)
Discussion started by: eyad mohammad
1 Replies

3. Homework & Coursework Questions

Please help me with my homework!!!

A shell script is a script written for the shell, or command line interpreter, of an operating system. Typical operations performed by shell scripts include file manipulation, program execution, printing text etc. Shell : In computing, a shell is a piece of software that provides an interface for... (1 Reply)
Discussion started by: ubun
1 Replies

4. Homework & Coursework Questions

Need some help with my homework

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi, since I'm relatively new to Unix I need some help. I've installed FreeBSD 8 on a virtual machine and I've done... (4 Replies)
Discussion started by: iLeeT777
4 Replies

5. Homework & Coursework Questions

Homework Help.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hello, My name is Jordan and studying at the New Bulgarian University in Sofiya. This is my homework but can... (2 Replies)
Discussion started by: freestar
2 Replies

6. UNIX for Dummies Questions & Answers

Homework :(

1. You have a very large file, named 'ColMe', tab-delimited, you are asked to process. You are told that each line in 'ColMe' has 7 columns, and that the values in the 5th column are integers. Using shell functions (and standard LINUX/UNIX filters), indicate how you would verify that these... (1 Reply)
Discussion started by: mb774
1 Replies

7. Post Here to Contact Site Administrators and Moderators

Homework?

https://www.unix.com/shell-programming-scripting/113946-scripts.html Looks like an assignment or homework to me, does it to you? (5 Replies)
Discussion started by: TonyFullerMalv
5 Replies
Login or Register to Ask a Question