#211 Typo error when check swish-e

current_cvs
closed-fixed
genxref (49)
5
2012-09-20
2012-06-14
squall.ho
No

at line 240, the wrong typo of
$toolloc = `which swhish-e 2>/dev/null`;

an extra "h" will make the $toolloc always be empty, since there is no binary named sw"h"ish-e.
should be correct as
$toolloc = `which swish-e 2>/dev/null`;

Discussion

  • Jan-Benedict Glaw

    Please don't use `which' any longer. To my knowledge, `command -v ...' is a portable replacement.

     
  • Andre-Littoz

    Andre-Littoz - 2012-06-24

    Thanks for pointing out the typo.

    To jbglaw:
    Why do you recommend not to use 'which'? I want to get the path to the executable, while 'command -v' will only print identification and version information.

    But portability-wise, I may be wrong. Instead of comparing path with value of parameter 'xxx-bin', I should blindly use parameter 'xxx-bin' with -v option and see if it returns the correct name for the tool. What is your opinion?

     
  • Jan-Benedict Glaw

    `command -v ....' should basically do what `which' did:

    jbglaw@pluto:~$ command -v vim
    /usr/bin/vim

    Does it behave differently on your system? So I'd just use

    $toolloc = `command -v swish-e 2>/dev/null`;

     
  • Andre-Littoz

    Andre-Littoz - 2012-06-25

    jbglaw, sorry! I misintrepreted 'command -v' for a "template" where command would be replaced by swish-e, glimpse or anything else. It is OK on my system.
    To your knowledge, is 'which' deprecated? is 'command' guaranteed to be accepted in ANY implementation of Perl?

    Regards,
    ajl

     
  • Andre-Littoz

    Andre-Littoz - 2012-07-20
    • assigned_to: nobody --> ajlittoz
     
  • Andre-Littoz

    Andre-Littoz - 2012-07-22

    Typo corrected in CVS
    Still considering whether to change "which" to "command" or not.

     
  • Andre-Littoz

    Andre-Littoz - 2012-07-22
    • status: open --> pending-fixed
     
  • Andre-Littoz

    Andre-Littoz - 2012-09-20

    After reading thoroughly the standards and other papers, decided to use "command -v" instead of "which", which would also remove a dependency on package which (at least in Fedora).

    Implemented in the new genxref for release 1.0

     
  • Andre-Littoz

    Andre-Littoz - 2012-09-20
    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks