Giter Club home page Giter Club logo

Comments (7)

framps avatar framps commented on July 30, 2024

I updated the README and created PR #43

from pishrink.

lurch avatar lurch commented on July 30, 2024

FYI, running sudo ./pishrink.sh ... works if you don't do sudo mv pishrink.sh /usr/local/bin ;-) (but then you end up with the pishrink.sh 'hanging around' in your home directory).

More details, for reference:
You're correct, ./ does mean use a relative directory reference, it means look in the current directory. But since you've now moved pishrink.sh from the current directory to /usr/local/bin, you either need to use sudo /usr/local/bin/pishrink.sh ..., or you can just use sudo pishrink.sh ... since /usr/local/bin is included in the $PATH variable. When you run a 'bare command' with no path prefix, the shell (in your case bash) looks for the command in each of the directories specified in $PATH.

from pishrink.

John-Mc avatar John-Mc commented on July 30, 2024

Thanks @lurch and @framps. I knew the bare command would look in the current directory plus anything in $PATH I knew ./ made it look in the current directory. I did not know it prevented it from looking in $PATH. Still learning my way around this stuff (as I guess is obvious).

from pishrink.

lurch avatar lurch commented on July 30, 2024

@John-Mc You're close... 😉 by default on Linux the current directory is never in the $PATH so if you have pishrink.sh in e.g. your home directory, then trying to run sudo pishrink.sh ... would fail, you either need to run sudo ./pishrink.sh ... or e.g. sudo /home/pi/pishrink.sh ...
If you give an explicit path to an executable (and ./ is an explicit path to the current directory), then the shell doesn't need to try searching the $PATH to find it :)

from pishrink.

lurch avatar lurch commented on July 30, 2024

@John-Mc Can this be closed, now that the README has been updated?

from pishrink.

Drewsif avatar Drewsif commented on July 30, 2024

Closing since its already merged

from pishrink.

John-Mc avatar John-Mc commented on July 30, 2024

Sure. Sorry, I didn't know the etiquette of closing an issue. I figured it was up to the site owner.

from pishrink.

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.