Write a Program that takes one or more file/directory names as command line input and reports the following information on the file. A). File type B). Number of links. C). Time of last access. D). Read,Write and Execute permissions.
AIM:
Write a Program that takes one or more file/directory names as command line input and reports the following information on the file. A). File type B). Number of links. C).Time of last access. D).Read,Write and Execute permissions.
Program:
clear for i in $* do if [ -d $i ] then echo “Given directory name is found as $i” fi if [ -f $i ] then echo “Given name is a file as $i “ fi echo “Type of file/directory $i” file $i echo “Last access time is:” ls -l$i | cut-c 31-46 echo "no.of links" ln $i if [ -x $i –a -w $i-a –r $i ] then echo “$i contains all permission” else echo “$i does not contain all permissions” fi done
Output:
student@ubuntu:~$sh prg12.sh ff1
given name is file ff1
Type of file/directory ff1
last access time
2012-07-07 10:1
No.of links
ff1 does not contain all permissions
-
UpdatedOct 23, 2014
-
Views14,299
Write a Shell script to find factorial of a given integer.
Write in C the following Unix commands using system calls A). cat B). ls C). mv
Write a Shell script that displays list of all the files in the current directory to which the user has read, Write and execute permissions.
Write a Shell script that accepts a filename, starting and ending line numbers as arguments and displays all the lines between the given line numbers.
Write a C program to emulate the Unix ls-l command.
Write a Shell script to list all of the directory files in a directory.