[GRASS-dev] Re: [GRASS GIS] #181: tac command missing in OSX
GRASS GIS
trac at osgeo.org
Wed Jun 4 13:48:29 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 glynn):
> > How about testing for the -r flag, as I mentioned?
>
> I'd recommend to check for the existence of `tac` instead,
Agreed.
> like (untested):
I suggest either using "type", or just running e.g. "tac < /dev/null" and
checking for an error. Scanning the path is problematic; it doesn't allow
for shell built-ins or aliases, may not allow for extensions on Windows,
etc.
That still doesn't solve the issue of what to do if the system has neither
tac nor "tail -r", neither of which are mandated by POSIX/XPG/SUS.
Off the top of my head, the only thing that I can think of is to prefix
each line with the line number using e.g. awk, use "sort -r", then strip
the line numbers.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/181#comment:5>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list