Re: [opensuse] BASH - better way to get total number of files matching glob??
- From: Jon Clausen <jon@xxxxxxx>
- Date: Thu, 27 May 2010 11:47:33 +0200
On Thu, 27 May, 2010 at 03:11:18 -0500, David C. Rankin wrote:
On 05/26/2010 02:05 AM, Jon Clausen wrote:
Haven't tested it, but I'm pretty sure files with whitespace will break
this, but you get the idea
That's what IFS=$'\n' is for :p
Indeed... however:
Now I *have* tested, and somewhat surprisingly (to me at least) filenames
with whitespace are not a problem:
jon@nx8220:~/tmp/test> ll
total 0
-rw-r--r-- 1 jon users 0 2010-05-27 11:39 file no1
-rw-r--r-- 1 jon users 0 2010-05-27 11:39 file no2
drwxr-xr-x 3 jon users 17 2010-04-21 09:32 Folder1
jon@nx8220:~/tmp/test> array=(*)
jon@nx8220:~/tmp/test> echo ${array[@]}
file no1 file no2 Folder1
jon@nx8220:~/tmp/test> echo ${#array[@]}
3
jon@nx8220:~/tmp/test> echo ${array[0]}
file no1
jon@nx8220:~/tmp/test> echo ${#array[0]}
8
so there :)
/jon
--
YMMV
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
- Follow-Ups:
- Re: [opensuse] BASH - better way to get total number of files matching glob??
- From: David C. Rankin
- Re: [opensuse] BASH - better way to get total number of files matching glob??
- References:
- [opensuse] BASH - better way to get total number of files matching glob??
- From: David C. Rankin
- Re: [opensuse] BASH - better way to get total number of files matching glob??
- From: Per Jessen
- Re: [opensuse] BASH - better way to get total number of files matching glob??
- From: Jon Clausen
- Re: [opensuse] BASH - better way to get total number of files matching glob??
- From: David C. Rankin
- [opensuse] BASH - better way to get total number of files matching glob??
- Prev by Date: [opensuse] Help with Makefile patch - it fails...
- Next by Date: [opensuse] Re: [URGENT] Assistance Requested in Looking for Dr Francis T. Seow, Harvard Law School Research Fellow
- Previous by thread: Re: [opensuse] BASH - better way to get total number of files matching glob??
- Next by thread: Re: [opensuse] BASH - better way to get total number of files matching glob??
- Index(es):
Relevant Pages
|