LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-18-2010, 01:28 AM   #1
blck_kenzo
LQ Newbie
 
Registered: Nov 2007
Posts: 15

Rep: Reputation: 0
Directory does not exist.


Hi all,

This is my code :

#!/bin/sh
folder="Type Yes if you want to show all files."
func() {
while true
do
echo -n "Enter yes or no: "
read x
case "$x" in
y|Y|yes|Yes|YES ) return 0 ;;
n|N|no|No|NO ) return 1 ;;
* ) echo "Answer Yes or No :" ;;
esac
done
}
echo $folder
if func [ -d /home/kenzo/script/Monday/ ] &&
{
set $(date)
echo "$1 $3 $2 $6"
ls -l /home/kenzo/script/Monday/
};then
echo "=============================================================="
else
echo "Not execute."
fi

It work well.
But I don't know how to show "Folder not exist" when I type Yes. (Monday folder does not exist in this case.)

Pls, help me to solve the problem. Thanks !
 
Old 10-18-2010, 02:25 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
You may find these techniques useful http://stackoverflow.com/questions/2...x-shell-script
 
Old 10-18-2010, 03:07 AM   #3
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,362

Rep: Reputation: 135Reputation: 135
Your script is working fine and its showing no such file or directory incase Monday doesnot exist.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to check directory exist or not nagendrar Solaris / OpenSolaris 1 04-30-2010 03:06 AM
Home directory does not exist emibee Linux - Laptop and Netbook 8 03-17-2009 04:20 PM
check if directory exist jaepi Programming 6 05-10-2007 09:45 PM
report that such directory doesn't exist hpaixao Programming 3 02-20-2005 11:30 AM
apache directory does not exist Smokey Slackware 5 08-25-2004 09:06 AM


All times are GMT -5. The time now is 10:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration