LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   strange output of regex (https://www.linuxquestions.org/questions/linux-newbie-8/strange-output-of-regex-771626/)

vinaytp 11-25-2009 11:20 PM

strange output of regex
 
Hi all...

Code:

[vinay@TEG test]$ echo grapes>"text sample2"
[vinay@TEG test]$ cat "`ls text*le2`"
grapes
[vinay@TEG test]$ cat "`ls text*2`"
cat: text2
text sample2: No such file or directory

Here I feel 3rd command should display contents of file "text sample2"...The output is really looking strange...How is this working ?

vinaytp 11-25-2009 11:27 PM

Quote:

Originally Posted by vinaytp (Post 3770000)
Hi all...

Code:

[vinay@TEG test]$ echo grapes>"text sample2"
[vinay@TEG test]$ cat "`ls text*le2`"
grapes
[vinay@TEG test]$ cat "`ls text*2`"
cat: text2
text sample2: No such file or directory

Here I feel 3rd command should display contents of file "text sample2"...The output is really looking strange...How is this working ?

I got the concept.....
shell is giving the cat command a single parameter text2..

Web31337 11-25-2009 11:29 PM

Code:

web31337@srvr:/tmp$ echo grapes>"text sample2"
web31337@srvr:/tmp$ cat "`ls text*le2`"
grapes
web31337@srvr:/tmp$ cat "`ls text*2`"
grapes

it works fine for me. works on debian lenny (2.6) and even on my freebsd vds.
i simply copypasted these commands from your code.

vinaytp 11-26-2009 04:39 AM

Quote:

Originally Posted by Web31337 (Post 3770007)
Code:

web31337@srvr:/tmp$ echo grapes>"text sample2"
web31337@srvr:/tmp$ cat "`ls text*le2`"
grapes
web31337@srvr:/tmp$ cat "`ls text*2`"
grapes

it works fine for me. works on debian lenny (2.6) and even on my freebsd vds.
i simply copypasted these commands from your code.

Hi web31337...
Code:

touch text2
Can you pls now execute those commands....

Web31337 11-26-2009 04:54 AM

mhm i get it.
cat text*2 is what you need.


All times are GMT -5. The time now is 04:11 AM.