This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: backtics


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.


tconway@tsmserv
/home/tconway>mkdir whitespace
tconway@tsmserv
/home/tconway>cd whitespace
tconway@tsmserv
/home/tconway/whitespace>touch '35ms '  '40ms '  '80ms '
tconway@tsmserv
/home/tconway/whitespace>ls
35ms   40ms   80ms 
tconway@tsmserv
/home/tconway/whitespace>ls `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.
tconway@tsmserv
/home/tconway/whitespace>ls |cat -vet
35ms $
40ms $
80ms $
tconway@tsmserv
/home/tconway/whitespace>cd ..
tconway@tsmserv
/home/tconway>rm -rf whitespace
tconway@tsmserv
/home/tconway/whitespace>rm '35ms '  '40ms '  '80ms '
tconway@tsmserv
/home/tconway/whitespace>touch '
35ms' '40ms 
> ' ' 80 ms      '
tconway@tsmserv
/home/tconway/whitespace>ls

35ms   80 ms       40ms

tconway@tsmserv
/home/tconway/whitespace>ls `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.
tconway@tsmserv
/home/tconway/whitespace>ls |cat -vet
$
35ms$
 80 ms^I $
40ms$
$
tconway@tsmserv
/home/tconway/whitespace>rm *
tconway@tsmserv
/home/tconway/whitespace>touch '35ms  40ms  80ms'
tconway@tsmserv
/home/tconway/whitespace>ls
35ms  40ms  80ms
tconway@tsmserv
/home/tconway/whitespace>ls `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.
tconway@tsmserv
/home/tconway/whitespace>ls |cat -vet
35ms  40ms  80ms$
tconway@tsmserv
/home/tconway/whitespace>rm *
tconway@tsmserv
/home/tconway/whitespace>touch "`(time sleep 1) 2>&1`"
tconway@tsmserv
/home/tconway/whitespace>ls

real    0m1.002s
user    0m0.001s
sys     0m0.001s
tconway@tsmserv
/home/tconway/whitespace>ls -l
total 0
-rw-r--r--    1 tconway  admins            0 Sep 24 15:19 
real    0m1.002s
user    0m0.001s
sys     0m0.001s
tconway@tsmserv
/home/tconway/whitespace>rm *
tconway@tsmserv
/home/tconway/whitespace>touch "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"
tconway@tsmserv
/home/tconway/whitespace>ls
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
tconway@tsmserv
/home/tconway/whitespace>ls -l
total 0
-rw-r--r--    1 tconway  admins            0 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
tconway@tsmserv
/home/tconway/whitespace>cd ..
tconway@tsmserv
/home/tconway>rm -rf whitespace
tconway@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]