954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

shell script

i want to give a filename in commandline itself and want to check whether it is a directory are not.shall i use this command

if [ -f $filename ]

vignesh viki
Newbie Poster
5 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

I've already answered you.

L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
 
if [ -d $1 ]; then
  ls -l $1>file1.txt;
  awk -f '{print tolower($8)}' file1.txt;
else 
  echo "it is not a directory";
fi
vignesh viki
Newbie Poster
5 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You