[GRASS-dev] Re: [GRASS GIS] #181: tac command missing in OSX
GRASS GIS
trac at osgeo.org
Wed Jun 4 13:09:09 EDT 2008
#181: tac command missing in OSX
------------------------+---------------------------------------------------
Reporter: kyngchaos | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: minor | Milestone: 6.3.1
Component: default | Version: 6.3.0
Resolution: | Keywords: v.in.garmin, v.in.mapgen
------------------------+---------------------------------------------------
Comment (by 1gray):
Replying to [comment:3 kyngchaos]:
> Replying to [comment:2 hamish]:
> > Can the Mac build provide a copy of tac somehow? (or just
automatically apply the 'tail -r' patches with your build..)
> I ''could'' provide a copy or patch it in my binary, but that's just a
packager's solution, and those who build from source would still have to
deal with it somehow. tac is annoying in that it's part of a GNU bundle,
core-utilities, I couldn't find only tac source. And my first
quick-n-dirty attempt to compile it failed.
That's how most bundles work. One couldn't, e. g., easily compile
`r.what` without compiling the rest of GRASS as well.
> How about testing for the -r flag, as I mentioned? A non-existent
option on OSX returns `tail: illegal option xxx` plus a usage string with
the available flags. What about other versions of tail? Or can you thing
of a good way to test for the flag? If anything, I could test for
uname=Darwin (tho that's awfully specific).
I'd recommend to check for the existence of `tac` instead, like
(untested):
{{{
search_for_executable () {
echo "$PATH" | tr : \\n | while read _search_for_executable_dir ; do
if [ -x "$_search_for_executable_dir/$1" ]; then
echo "$_search_for_executable_dir/$1"
break
fi
done
}
if [ -n "$TAC" ]; then
TAC=tac
else
TAC=$(search_for_executable "tac")
fi
if [ -z "$TAC" ]; then
## no `tac' found, fall back to `tail -r' instead
TAC="tail -r"
fi
...
$TAC arguments...
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/181#comment:4>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list