Git Product home page Git Product logo

Comments (11)

PerBothner avatar PerBothner commented on June 9, 2024

I use bin/domterm all the time. Probably an incompatibility in "which":

$ which --version
GNU which v2.20, Copyright (C) 1999 - 2008 Carlo Wood.
GNU which comes with ABSOLUTELY NO WARRANTY;
This program is free software; your freedom to use, change
and distribute this program is protected by the GPL.

The man page says: "For each of its arguments it prints to stdout the full path of the executables that would have been executed when this argument had been entered at the shell prompt."

Seems like the MacOS version (presumably from BSD?) isn't as capable.

We also have the option of using the bash builtin 'type',but that doesn't handle the "bin/domterm" case, it appears.

from domterm.

rwhogg avatar rwhogg commented on June 9, 2024

My which doesn't even support --version (or even -v) as an option - looks like I'm using the debianutils version.

It's worth noting that you mentioned bash. I'm on zsh, and so are many others. Since any Linux worth its salt has bash installed and so does OS X, would you be willing to put a shebang line in the script to ensure everyone is running it on the same shell?

from domterm.

PerBothner avatar PerBothner commented on June 9, 2024

Yes, I'm fine restricting it to bash. After all, I require Java (for now); maximum portability can wait. (The Windows port may be more interesting ...)

from domterm.

rwhogg avatar rwhogg commented on June 9, 2024

brew install gnu-which fixed it for me. Thanks for the suggestion about which!

from domterm.

rwhogg avatar rwhogg commented on June 9, 2024

I'm going to close this. Feel free to reopen if you want.

from domterm.

tschwinge avatar tschwinge commented on June 9, 2024

I also ran into this. As it gives a first bad impression ("doesn't run out of the box"), I suggest you re-open this (I can't); I'll submit a patch later.

from domterm.

PerBothner avatar PerBothner commented on June 9, 2024

Would it make sense to use 'type -p'? It seems to Do The Right Thing (based on a few tests). It means we require bash (though ksh also seems to work). As a bonus, it's faster, since it's built-in.

from domterm.

PerBothner avatar PerBothner commented on June 9, 2024

What do you think of the following:

#!/bin/bash
thisfile=`type -p $0`
case "$thisfile" in
  "") echo "installation error - can't find path to $0"; exit -1 ;;
  /*) ;;
  *) thisfile="$PWD/$thisfile"  ;;
esac         
while test -L "$thisfile"; do thisfile=$(readlink -f "$thisfile"); done
DOMTERM_DIR=`echo $(dirname $thisfile) | sed -e 's|/bin$||'`

etc as before

from domterm.

rwhogg avatar rwhogg commented on June 9, 2024

I can verify that the above works.

from domterm.

PerBothner avatar PerBothner commented on June 9, 2024

I checked this change in. Thanks for testing it.

from domterm.

tschwinge avatar tschwinge commented on June 9, 2024

Yes, type -p is more portable (and works for me, too) -- but then I wonder why this code needs to be so complicated? See my #22.

from domterm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.