Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Others => Miscellaneous => Topic started by: rajesh.bahl on November 13, 2007, 06:35:58 PM

Title: Difference In Command
Post by: rajesh.bahl on November 13, 2007, 06:35:58 PM

Hi Guys!

Need your views on this :-

If I run the command:

find / -name  foo* -print

on my system, I get a big listing of 121 files.

Again if I run :

find / -name foo\* -print

I get the same listing of 121 files.


What exactly is the difference between these two commands ? Under what scnerio each one is used ?
If possible quote some examples in your explanations !

regards
rajesh.bahl
Title: Re: Difference In Command
Post by: Ricky on November 14, 2007, 09:22:25 PM
Both commands are same ie. will give same output, both will list files whose name starts with "foo"

The difference is that in foo\* is acting as escape character as we do in programming, some shell need this to specifically specify and some do not hence both are working.
Title: Re: Difference In Command
Post by: dragoncity99 on December 15, 2007, 02:59:35 AM
FYI

[root@rhel4 /]# find /root -name foo*
/root/foo2
/root/foo1
/root/foo*
[root@rhel4 /]#
[root@rhel4 /]#
[root@rhel4 /]# find /root -name foo\*
/root/foo2
/root/foo1
/root/foo*
[root@rhel4 /]#
[root@rhel4 /]#
[root@rhel4 /]# find /root -name "foo\*"
/root/foo*
[root@rhel4 /]#
Title: Re: Difference In Command
Post by: Ricky on December 18, 2007, 06:53:10 AM
That is clear :)