LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-29-2003, 05:55 AM   #1
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Rep: Reputation: 32
cancel shell programm is dir is empty


hy!

I would like to use a programm that should email a file if it exists.

The problem is:

I would like the programm to end at once if no file exists in a special dir.

Something like:

$dir = \home\mailfiles

if filecount.$dir = 0 then exit else

zip mail.zip $dir/*
mutt mail@somebody.com -s "subject" -a mail.zip < /tmp/mutt-linux-19305-0

Can someone help me ?

Thanks
 
Old 12-29-2003, 06:23 AM   #2
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Original Poster
Rep: Reputation: 32
got it

dateien=`ls /dirt/ | wc -l`
echo $dateien
if [ $dateien = 0 ]; then
exit
fi
 
  


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
rm -d non-empty dir, unlink or not? ekdya Debian 3 10-17-2005 09:59 AM
Bash Script test for empty dir uopjohnson Linux - Software 3 10-07-2005 06:45 PM
[c shell] file empty? saiz66 Programming 1 09-28-2004 10:57 PM
apt-get install results : non empty dir | and strange site eeried Linux - Newbie 0 06-16-2004 03:34 AM
shell scripting-.bash_profile empty mjkramer Linux - Newbie 1 10-04-2003 03:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:48 PM.

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
Open Source Consulting | Domain Registration