November 23, 2024, 12:59:47 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Difference In Command  (Read 6676 times)

Offline rajesh.bahl

  • Linux Learner
  • ***
  • Posts: 86
Difference In Command
« 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

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Re: Difference In Command
« Reply #1 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.

Offline dragoncity99

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 551
Re: Difference In Command
« Reply #2 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 /]#

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Re: Difference In Command
« Reply #3 on: December 18, 2007, 06:53:10 AM »
That is clear :)