backtics

2010-09-24 Thread melkor
This probably isn't a backtic problem, but using backtics causes it.

ls `ls`

results in file not found errors. ie:

bash-3.2$ ls
35ms  40ms  80ms
bash-3.2$ ls `ls`
ls: cannot access 35ms: No such file or directory
ls: cannot access 40ms: No such file or directory
ls: cannot access 80ms: No such file or directory
bash-3.2$


thanks


--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: backtics

2010-09-24 Thread Eric Blake

On 09/24/2010 07:43 AM, mel...@orangepalantir.org wrote:

This probably isn't a backtic problem, but using backtics causes it.

ls `ls`

results in file not found errors. ie:

bash-3.2$ ls
35ms  40ms  80ms
bash-3.2$ ls `ls`
ls: cannot access 35ms: No such file or directory
ls: cannot access 40ms: No such file or directory
ls: cannot access 80ms: No such file or directory
bash-3.2$


WJFFM:
$ mkdir abc  cd abc  touch 35ms 40ms 80ms
$ ls
35ms  40ms  80ms
$ ls `ls`
35ms  40ms  80ms

In trying to think of things that might be interfering, do you have a 
problematic alias or shell function named ls?  For example, if ls is 
aliased to 'ls --color=always', and those particular files would be 
colored by your dircolors settings, then I could see that causing a 
failure (hint, use --color=auto, not --color=always, when aliasing ls). 
 Also, running under 'set -vx' may be informative.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: backtics

2010-09-24 Thread Spiro Trikaliotis
Hello,

* On Fri, Sep 24, 2010 at 08:39:21AM -0600 Eric Blake wrote:
 On 09/24/2010 07:43 AM, mel...@orangepalantir.org wrote:
 This probably isn't a backtic problem, but using backtics causes it.

 ls `ls`

 results in file not found errors. ie:

 bash-3.2$ ls
 35ms  40ms  80ms
 bash-3.2$ ls `ls`
 ls: cannot access 35ms: No such file or directory
 ls: cannot access 40ms: No such file or directory
 ls: cannot access 80ms: No such file or directory
 bash-3.2$

 WJFFM:
 $ mkdir abc  cd abc  touch 35ms 40ms 80ms
 $ ls
 35ms  40ms  80ms
 $ ls `ls`
 35ms  40ms  80ms

Another option (for the OP):

Have you tried the command:

$ ls|wc -l


You ask why? Then try this:

$ touch 35ms  40ms  80ms
$ ls `ls`
ls: cannot access 35ms: No such file or directory
ls: cannot access 40ms: No such file or directory
ls: cannot access 80ms: No such file or directory

Here, ls|wc -l gives 1 as output.

HTH,
Spiro.

-- 
Spiro R. Trikaliotis  http://opencbm.sf.net/
http://www.trikaliotis.net/ http://www.viceteam.org/

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



RE: backtics

2010-09-24 Thread Conway, Timothy
This probably isn't a backtic problem, but using backtics causes it.

ls `ls`

results in file not found errors. ie:

bash-3.2$ ls
35ms  40ms  80ms
bash-3.2$ ls `ls`
ls: cannot access 35ms: No such file or directory
ls: cannot access 40ms: No such file or directory
ls: cannot access 80ms: No such file or directory bash-3.2$

++

Almost certainly we're looking at whitespace characters.  ls reads the 
directory and displays the names., but command expansion delivers them as a 
whitespace-delimited array.  Here's the same thing duplicated several ways on 
AIX.


tcon...@tsmserv
/home/tconwaymkdir whitespace
tcon...@tsmserv
/home/tconwaycd whitespace
tcon...@tsmserv
/home/tconway/whitespacetouch '35ms '  '40ms '  '80ms '
tcon...@tsmserv
/home/tconway/whitespacels
35ms   40ms   80ms 
tcon...@tsmserv
/home/tconway/whitespacels `ls`
ls: 0653-341 The file 35ms does not exist.
ls: 0653-341 The file 40ms does not exist.
ls: 0653-341 The file 80ms does not exist.
tcon...@tsmserv
/home/tconway/whitespacels |cat -vet
35ms $
40ms $
80ms $
tcon...@tsmserv
/home/tconway/whitespacecd ..
tcon...@tsmserv
/home/tconwayrm -rf whitespace
tcon...@tsmserv
/home/tconway/whitespacerm '35ms '  '40ms '  '80ms '
tcon...@tsmserv
/home/tconway/whitespacetouch '
35ms' '40ms 
 ' ' 80 ms  '
tcon...@tsmserv
/home/tconway/whitespacels

35ms   80 ms   40ms

tcon...@tsmserv
/home/tconway/whitespacels `ls`
ls: 0653-341 The file 35ms does not exist.
ls: 0653-341 The file 80 does not exist.
ls: 0653-341 The file ms does not exist.
ls: 0653-341 The file 40ms does not exist.
tcon...@tsmserv
/home/tconway/whitespacels |cat -vet
$
35ms$
 80 ms^I $
40ms$
$
tcon...@tsmserv
/home/tconway/whitespacerm *
tcon...@tsmserv
/home/tconway/whitespacetouch '35ms  40ms  80ms'
tcon...@tsmserv
/home/tconway/whitespacels
35ms  40ms  80ms
tcon...@tsmserv
/home/tconway/whitespacels `ls`
ls: 0653-341 The file 35ms does not exist.
ls: 0653-341 The file 40ms does not exist.
ls: 0653-341 The file 80ms does not exist.
tcon...@tsmserv
/home/tconway/whitespacels |cat -vet
35ms  40ms  80ms$
tcon...@tsmserv
/home/tconway/whitespacerm *
tcon...@tsmserv
/home/tconway/whitespacetouch `(time sleep 1) 21`
tcon...@tsmserv
/home/tconway/whitespacels

real0m1.002s
user0m0.001s
sys 0m0.001s
tcon...@tsmserv
/home/tconway/whitespacels -l
total 0
-rw-r--r--1 tconway  admins0 Sep 24 15:19 
real0m1.002s
user0m0.001s
sys 0m0.001s
tcon...@tsmserv
/home/tconway/whitespacerm *
tcon...@tsmserv
/home/tconway/whitespacetouch Hello.  I am a unix file.
 I'm still just this one single file, but I have many lines
 in my name.  I even have \all three\ types of \\quotes in my name
tcon...@tsmserv
/home/tconway/whitespacels
Hello.  I am a unix file.
I'm still just this one single file, but I have many lines
in my name.  I even have all three types of \quotes in my name
tcon...@tsmserv
/home/tconway/whitespacels -l
total 0
-rw-r--r--1 tconway  admins0 Sep 24 15:15 Hello.  I am a unix 
file.
I'm still just this one single file, but I have many lines
in my name.  I even have all three types of \quotes in my name
tcon...@tsmserv
/home/tconway/whitespacecd ..
tcon...@tsmserv
/home/tconwayrm -rf whitespace
tcon...@tsmserv
/home/tconway

That last one's a funny one to drop on a new unix user.





--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple