Giter Club home page Giter Club logo

Comments (5)

eradman avatar eradman commented on June 30, 2024 1

Cool! Closing

The man page isn't the right place to hilight shell nuances. But I'd be happy to add hints on avoiding shell pitfalls to http://eradman.com/entrproject/

Feel free to suggest a new section or edits to that page.

from entr.

eradman avatar eradman commented on June 30, 2024

Glad you like it!

It appears that fish -c doesn't set $N based on supplied arguments

$ fish -c 'echo $0' one

Where as bash, ash, ksh, sh do:

$ sh -c 'echo $0' one
one

Does fish use an alternate convention for passing variables?

from entr.

semanticart avatar semanticart commented on June 30, 2024

Indeed it does.

fish -c 'echo $argv[1]' one

This works as expected (array indices start at 1 instead of 0).

This still doesn't work though

ls | entr -s "echo $argv[1]"

And neither does the bash equivalent

$ export SHELL=/opt/homebrew/bin/bash
$ ls | entr -s "echo $0"

bash returned exit code 0

bash returned exit code 0

🤔 Is ls | entr -s "echo $0" a valid test for bash/sh/etc? If not, what should I be doing instead?

from entr.

eradman avatar eradman commented on June 30, 2024

Ah, make sure you use single quotes! When you use double-quotes variables are evaluated before entr runs.

from entr.

semanticart avatar semanticart commented on June 30, 2024

@eradman That works! TYSM for helping me debug this. That behavior makes sense in retrospect.

I know what one chooses to include/exclude in the manual page is always a balance, but do you think this single quote caveat might be worth including? (I am happy to concede that the fish-specific behavior is probably not worth including)

from entr.

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.