Re: [SLUG] dot's function in *nix

From: Mario Lombardo (mario@alienscience.com)
Date: Mon Dec 31 2001 - 11:02:19 EST


That's interesting! I touch-ed ttt and 'ls | grep ".."' found it, so
I suppose it literally states "LiSt all and obtain(grep) any
filename/directories with two characters or more", yet it missed the
files beginning with a dot.

However, with respect to Paul Foster's reply, I see why it did, so in doing a:

ls -a | grep ".."

it picks up *all* files/directories (including the hidden ones--ones
beginning with a dot). I'll have to take Ed Centanni's advice and
check out more in the man page for grep about these nifty regular
expressions. My electronic organizer has a database of regular
expressions although I could never figure out how to use them. Maybe
now, I will.

Mario

>The difference is dot in a command shell context (ls . or ./myscript)
>where is means the current directory versus dot in a regulat expression
>context (apropos .) where it matches any single character. And of
>course it can also be used in filenames as a normal character..
>
>try this
>mkdir tmp
>cd tmp
>touch t
>touch tt
>ls | grep "."
>ls | grep ".."
>
>
>
>
>------------------------------------------------------------------------
>Jim Wildman, CISSP jim@rossberry.com
>817-308-3868 http://www.rossberry.com
>
>On Sun, 30 Dec 2001, Mario Lombardo wrote:
>
>> In the thread subject 'A "whatis" catalog', I was once again
>> mystified by the use of the dot in Unix-like systems. I originally
>> thought the use of dot was merely to state "here" or "from here" as
>> in the example of filesytems use:
>>
>> ls .
>> sh ./myscript
>>
>> But the dot turned out to be more than that when I saw people using
>> it in other ways; most recently from Ed Centanni's REply to my
>> question with this as the best working model:
>>
>> apropos . | sort > mycatalog.txt
>> versus...
>> apropos * | sort > mycatalog.txt
>>
>> I don't understand the literal interpretation of the dot in this
>> example versus using an asterisk. Actually, an asterisk doesn't
>> discover as many commands as the dot. In fact, doing a search for
>> the command chfn doesn't come up in the asterisk solution, yet it
>> comes up in the dot solution. This seems opposite of what would work
>> in the DOS world--which is my background.
>>
>> URL reading sources are fine. I just want to understand how to
> > utilize this little gem in other ways...if there are any more.
> >
> > Thanks,
> > Mario
> >

-- 



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:29:10 EDT