Re: (OT) path_helper [was Re: Xterm not reading dotfiles]
Re: (OT) path_helper [was Re: Xterm not reading dotfiles]
- Subject: Re: (OT) path_helper [was Re: Xterm not reading dotfiles]
- From: "Mark J. Reed" <email@hidden>
- Date: Sun, 18 Nov 2007 21:24:25 -0500
path_helper is something of a mess. It is taking forever to process
my admittedly-long MANPATH, due I think to the pathological nature of
the *(*:)$p*(:*) regex. @($p:*|*:$p:*|*:$p) would seem to be a better
choice.
Also, it won't work if any of the desired path entries contain spaces.
The loop construct it uses to read the files { for p in $(<"$f") }
assigns p to each *word*, not each *line*. To loop through lines,
something like this would work:
exec 3<"$f"
while IFS= read -u3 -r p; do
...
done
There are other issues, but they're mostly stylistic/portability
concerns. For instance, putting #!/bin/sh when it relies wholly on
bashisms to function (the first command in the file is bash-specific);
using an oddly mixed function definition syntax with both the
keyword and the parens, etc.
IMESHO, this particular program might be best written in a different
language. C, for instance. Or Perl/Python/Ruby/Tcl - they all ship
standard with OSX, right? Any of them would probably do this more
efficiently than bash; it's not the sort of thing the shell is
optimized for.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden