Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[ -f glob ]

here's a weird one...

this is part of a sanity test on line 369 of my zshrc (link below):
    [ -f /usr/{share,lib,share/lib}/{zoneinfo,locale/TZ}/${TZ} ]

here it works:	  zsh 4.2.1 (i386-portbld-freebsd4.7)
here it doesn't:  zsh 4.2.1 (sparc-sun-solaris2.10)

on _both_ systems, the command below will show errors for non-existent files (to stderr), and will show that a tz-file exists (to stdout). on both systems the command returns >0.
 % ls -l  /usr/{share,lib,share/lib}/{zoneinfo,locale/TZ}/${TZ}

this works on both bsd and solaris:
 % ls /usr/{share,lib,share/lib}/{zoneinfo,locale/TZ}/${TZ} 2> /dev/null | grep -q $TZ

i can use the return status from grep to determine if the file exists. but i'd prefer to keep this in zsh, as much as possible. i suppose i could assign stdout to a variable, test for the variable, and do it that way... but it seems a bit convoluted.

1) why does this behave differently with two different builds of zsh-4.2.1? has it likely been fixed since 4.2.1?

2) is there a simple fix? or simple workaround?

my zshrc is v0.119 - http://smasher.org/zsh/


 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808

	"The capitalists owned everything in the world, and everyone
	 else was their slave. They owned all the land, all the
	 houses, all the factories, and all the money. If anyone
	 disobeyed them they could throw him into prison, or they
	 could take his job away and starve him to death. When any
	 ordinary person spoke to a capitalist he had to cringe and
	 bow to him, and take off his cap and address him as 'Sir'"
		-- George Orwell

Messages sorted by: Reverse Date, Date, Thread, Author