Write a Shell script to list all of the directory files in a directory.
AIM:
Write a Shell script to list all of the directory files in a directory.
Program:
# !/bin/bash echo "enter directory name" read dir if[ -d $dir] then echo "list of files in the directory" ls –l $dir|egrep ‘^d’ else echo "enter proper directory name" fi
Output:
guest-glcbIs@ubuntu:~$sh lprg6.sh
enter directory name
dir1
list of files in the directory
drwxrwxr-x 4 guest-glcbls guest-glcbls 140 2012-07-06 14:40 dir1
-
UpdatedOct 23, 2014
-
Views39,808
You May Like
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.