Any way to stop a remote box gone crazy?

Dan Nelson dnelson at allantgroup.com
Wed Jul 23 15:13:32 PDT 2003


In the last episode (Jul 23), sedwards at qrwsoftware.com said:
> Quoting Dan Nelson <dnelson at allantgroup.com>: 
> > In the last episode (Jul 23), Rus Foster said: 
> > > > cd seems to work (I can cd to directories that I know exist,
> > > > but get an error if I try to cd to a directory that doesn't),
> > > > but echo always just returns *
> > >  
> > > hmm strange...it could be the shell as echo * on mine does and ls 
> >  
> > "echo *" in an empty directory will print "*", since /bin/sh passes
> > unmatched patterns through.
> >  
> > --  
> > 	Dan Nelson 
> > 	dnelson at allantgroup.com 
> >  
>  
> But I would think that this means the shell couldn't open the
> directory to get the filenames to match?

That's also a possibility.  You can use cat to tell the difference
though..  Here's a "ls" shell function that knows the difference
between an empty directory and one it can't read.  Unfortunately, it
requires cat, whereas plain "echo *" is done without forking:

ls () { cat . > /dev/null && echo * ; }

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-questions mailing list