This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: backtics
- From: "Conway, Timothy" <Timothy dot Conway at jbssa dot com>
- To: "melkor at orangepalantir dot org" <melkor at orangepalantir dot org>, "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Fri, 24 Sep 2010 15:21:35 -0600
- Subject: RE: backtics
- References: <79eb8d2be6552119c923d635791104be.squirrel@orangepalantir.org>
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