#8474: Detect whether a program is in the path
-----------------------------+----------------------------------------------
Reporter: jhpalmieri | Owner: drkirkby
Type: defect | Status: needs_work
Priority: blocker | Milestone: sage-4.3.4
Component: porting | Keywords:
Author: John Palmieri | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------+----------------------------------------------
Comment(by drkirkby):
Just to show you what I mean, here is the output when testing for an
existing file, and a non-existing file. Note there is a different response
from Solaris 10 (on SPARC) to all the others if the command is not found,
but the exit code remains non-zero on Solaris 10 (SPARC).
If the command is found on Solaris 10, then the output is exactly the same
as on every other platform, and exactly the same as 'which'. But I think
'command -v' is preferable, as it is more portable.
On Solaris 10 (SPARC processor):
{{{
drkir...@redstart:~$ command -v ls
/usr/bin/ls
drkir...@redstart:~$ command -v fdsfdgddgt
-bash: command: fdsfdgddgt: not found
}}}
On HP-UX (PA-RISC processor):
{{{
-bash-4.0$ command -v ls
/usr/bin/ls
-bash-4.0$ command -v lssdsssdfdf
-bash-4.0$
}}}
On !OpenSolaris (Intel Xeon processor):
{{{
drkir...@hawk:~$ command -v ls
/usr/bin/ls
drkir...@hawk:~$ command -v klsddshfsd
drkir...@hawk:~$
}}}
On OS X (Intel processor of some sort):
{{{
[kir...@bsd ~]$ command -v ls
/bin/ls
[kir...@bsd ~]$ command -v reererer
[kir...@bsd ~]$
}}}
On Linux (Intel processor of some sort)
{{{
kir...@sage:~$ command -v ls
/bin/ls
kir...@sage:~$ command -v fdlkskld
kir...@sage:~$
}}}
On FreeBSD (!VirtualBox virtual machine, running on !OpenSolaris host):
{{{
eagle# command -v ls
/bin/ls
eagle# command -v sdfdsf
eagle#
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8474#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.