Sunteți pe pagina 1din 2

1. Write a script that would display the time when run.

2. Write a script that would wait 5 seconds, then display the time, but 5 seconds late. Hint: use the
"sleep" command.
3. Write a script that will take a person's name as a parameter to the program name. The script
should greet that person, as
Good Day name_entered, How are you today

4. Write a script that will accept any number of parameters. The program should display whether
an odd or an even number of parameters was given

5. Write a series of scripts that will count the number of parameters on the command line, first
using the for statement, then the while and finally the until statement. (Three scripts).

6. Write a script that will echo the third parameter, but only if it is present.

7. Given a file of numbers (one per line), write a script that will find the lowest and highest
number.

8. Use expr to extract the parent directory from absolute pathname of a file stored in a variable x.

9. Display the processes in the system every 30 seconds five times using a i) while loop ii) for
loop.

10. Write a script that lists files by modification time when called with lm and by process
time whel called with la. By default, the script should show the listing of all files in the
directory.

11. Write a script that accepts filename as an argument and displays the last modification
time if the file exists and a suitable message if it doesn't.

12. Write a shell cript that searches for a pattern(supplied as argument) in all files in he
current directory and then calls up the vi editor with those files containing the pattern. How will
you repeat the serach in the current file and other files?

13. Write a script asking the user to input some numbers. The script should stop asking for
numbers when the number 0 is entered. The output should look like:

User: logon_name

Lowest number entered:

Highest number entered:


Difference between the two:
Product of the two:

14. Devise a script that looks at every component of PATH and checks whether teh
directory exists and is also accessible.

15. Write a script which looks up every .c file in the current directory for strings printf of
fprintf. If found , the script adds the statement #include<stdio.h> at the begining of the file but
only if it doesn't already have it included.

16. Write a script to convert all DOS style backslashes to UNIX style slashes in a list of
files.

17. Write a script to list all the differences between two directories.

18. Convert string "hi pravin how are you?" to "Hi Pravin How Are You?".

19. Use find and locate to search for a file and explain the difference between them?

20. Write a shell script to looking at the log file to see if the test has passed or not ?

21. How to check file properties?

22. How does getopts command work?

23. Explain about shebang?

24. how do u do debugging in unix/ linux platform for a shell program?

25. Write a shell script to looking at the log file to see if the test has passed or not ?

26. What is the use of script interpreter in shell scripting?

27. In shell scripting if text is surrounded by single quotes what does it denotes?

28. What is the use of "shift" command in passing parameters?

29. What are the different methods available to run a shell script?

30. How will you list only the empty lines in a file (using grep)?

31. What is the difference between a process and a thread?

S-ar putea să vă placă și