shell tricks (Re: bash if file exists)

Ben Holland sheepskin505 at gmail.com
Fri Apr 4 09:48:14 EDT 2008


Just as a quick question and i'm not trying to be a dick about it, but if
you have a major file system corruption, why would the ability to know what
files are there be important. I really do ask this question in earnest, and
more to the point even, if the file system is hosed, and you can still
though the luck of the gods read the inode table how would the actual files
themselves not be corrupted. I mean, i'm kinda assuming that you picked this
info up because you had to, i'm just wondering about the circumstances.

2008/4/3 Derek Martin <invalid at pizzashack.org>:

> On Thu, Apr 03, 2008 at 06:26:38PM -0400, Derek Martin wrote:
> > foo=`echo *.zip |grep -v '*\.zip'`
>
> Incidentally, in this way, echo can be used like ls:
>
>  $ echo *
>
> Why is this useful to know?  Say your system has severe filesystem
> corruption, and /bin/ls is one of the files that was corrupted.  In
> general, if that happens, ls will not work, but if your shell still
> works, you can still get a list of the files in the directory with
> that command.  If you want to also see "hidden" files, then this:
>
>  $ echo * .[A-Za-z0-9]*
>
> Of course, that assumes Roman alphanumeric characters.  It doesn't
> work very well if you have files called things like  .휴지통 in the
> directory.  =8^)
>
>
> --
> Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
> -=-=-=-=-
> This message is posted from an invalid address.  Replying to it will
> result in
> undeliverable mail due to spam prevention.  Sorry for the inconvenience.
>
>
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://lists.blu.org/mailman/listinfo/discuss
>
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the Discuss mailing list