Linux and X-Windows Programming - Assignment-III

advertisement
Code – ETCS-307
LINUX AND X WINDOWS PROGRAMMING
Assignment III
Question1:
a) How do you insert a line before the first line?
b) How do you change the contents of current line completely?
c) How do you abort an editing session?
d) How d and y are different in command mode commands?
e) How do you delete text from current line to the beginning of the file?
f) How do you redo your undone instruction?
g) How do you move six lines up?
h) What is the difference between the following vi commands:
:w
:q!
:wq
Question 2:
a) Does rm * remove all the files?
b) How do you list all the file names that have atleast four characters?
c) When using cat > foo, what happens if the file already contains
something?
d) What happens when you use who >> foo and foo doesn’t exist?
e) What is the difference between echo “$SHELL” and echo
‘$SHELL’?
f) How do you find number of users logged in?
g) What is the best method to ensure errors are not seen on the terminal?
h) What is the standard shell used in Linux?
i) What is the difference between $ wc –l < file1 and $ wc –l
file1?
j) To read v1, v2 and v3, how many values can be supplied?
k) What does the command $ cut –c 10-14 file2 do?
l) What are the various ways to execute the shell script?
m) Is the output of the command $ cat foo1 foo2 > /dev/tty
directed to standard output?
Question 3: Write a command to
a) Replace every occurrence of pattern “isn’t” with “isnot” in the file
b) Change all occurrences of the word “the” with “THE”.
c) Remove duplicate lines in sort.
Arena Nishant
Page 1
d) Present lines in reverse order
e) To find out common names from two sorted lists
Question 4:
a) What is the exit status of a command? What is the normal value and
where the value is stored?
b) If a script run as foo –l –t bar[1-3]. What are the values of $#
and $*?
c) If a file containing nothing is executed, what value will be returned?
Arena Nishant
Page 2
Download