Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
Others => Miscellaneous => Topic started 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
-
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.
-
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 /]#
-
That is clear :)