[prog] [Bash] script question

Cliff Crawford cjc26 at cornell.edu
Sun Sep 29 15:28:19 EST 2002


On Sun, Sep 29, 2002 at 11:01:48AM +0100, Conor Daly wrote:
> The other possible problem is in:
> 
> for file in $maildir
> 
> since $maildir = ~shuyingw/mail
> 
> $file will only contain that value.  What you need there is something like
> 
> cd $maildir
> for file in `/bin/ls`
> 
> Note the use of /bin/ls rather than ls alone.  This will bypass any "ls
> --color" type aliases which will produce odd characters in the filenames.

You can also do:

for file in $maildir/*

although then $file will contain the complete path of the file,
instead of just the filename.  But that shouldn't be a problem for
this script.


-- 
Cliff Crawford               ::               cjc26 at cornell dot edu
We allow our ignorance to prevail upon us and make us think we can
survive alone, alone in patches, alone in groups, alone in races, even
alone in genders.                                      -- Maya Angelou



More information about the Programming mailing list