list files but not directory

Mikkel L. Ellertson mikkel at infinity-ltd.com
Sun Aug 23 16:26:05 UTC 2009


Steven W. Orr wrote:
> 
> Two things!
> 
> 1. Bash syntax:
> This will not work:
> function lsp() { ls $@ && less }
> If you do it in one line then it would have to be
> function lsp() { ls $@ && less; }
> 
Yes - I did forget the ; at the end of the command. Bad morning...

> If you say ls && less then you will only run the less command if the ls
> command succeeds with a 0 exit status. I know this was a typo but I just
> didn't want others to get confused.
> 
I prefer not to have less run id ls exits with an error. That way,
if I run something like lsd *.html on a directory with no .html
files in it, I do not have to type the q to exit less.

> *NEVER* use $@ without using double quotes. It is very bad luck and failure to
> follow this advise will cause you to send 200 copies of stupid jokes to all
> the people you know with aol addresses. And worse, you will end up knowing
> more aol people.
> 
Oops - definitely a good point!

> What's the difference between an alias and a function? Simple: If you need to
> pass arguments then use a function. I mention this because it's another of
> those basic sources of confusion.
> 
I nice explanation.

Mikkel
-- 

  Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20090823/a9904104/attachment-0001.bin 


More information about the users mailing list