[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dir / ls routines return values
From: |
Daniel J Sebald |
Subject: |
dir / ls routines return values |
Date: |
Sun, 25 Jan 2009 02:52:06 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 |
The dir() and ls() routines return strings for file names in a directory, but
they place breaks in file names with spaces, which ostensibly makes the
routines not useful for programming. [I'm not a fan of spaces in file names...
one of the most confusing and messy conventions in computer programming.]
For example, try
mkdir('dir with spaces and # @ $ % [ ]')
dir('./')
ls -1
d = ls -1
Note a couple things. The list returned by dir and ls have line breaks, so
there is no way to know exactly where line breaks and spaces are in files.
There is no robust way of using dir and ls that I see.
The second thing is that 'ls -1' gives a result that looks correct, spaces
intact. But 'ls -1' by itself does not return anything into 'ans'. That's
strange and inconsistent.
Dan
- dir / ls routines return values,
Daniel J Sebald <=