Giter VIP home page Giter VIP logo

Comments (10)

chr15m avatar chr15m commented on July 28, 2024 1

@charlespwd I just pushed a fix for using flk in the hash-bang. To test this:

  • Have flk on your path.
  • Have a script with #!/usr/bin/env flk as the first line.
  • Make it executable.

Then call your Fleck script and it should execute correctly.

Please let me know if you get a chance to test it so we can close this one.

from flk.

charlespwd avatar charlespwd commented on July 28, 2024 1

Works! Awesome!

from flk.

charlespwd avatar charlespwd commented on July 28, 2024

Ah it looks like that's not possible because of shebang nesting.

Most operating systems do not allow a shell script to be the interpreter in a shebang for security reasons. – chepner Nov 14 '15 at 15:33

from flk.

chr15m avatar chr15m commented on July 28, 2024

Ah that's a bummer. What about if there was a small compiler script which would take your script + the fleck source and compile them together into a new file? Shouldn't be hard to whip up.

from flk.

chr15m avatar chr15m commented on July 28, 2024

I just whipped this up:

$ cat wow.clj 
(println "WOW")

$ make DEST=wow INSERT=./wow.clj
cat mal/bash/mal | sed '/then exit/,$d' > wow
cat src/extras.sh >> wow
echo 'read -d "" _REPCAPTURE <<INLINEMALFILE' >> wow
cat mal/lib/alias-hacks.mal  mal/lib/pprint.mal  >> wow
[ "./wow.clj" = "" ] || cat ./wow.clj >> wow
echo 'INLINEMALFILE\nREP "(do ${_REPCAPTURE})";\n' >> wow
cat src/file-repl.sh >> wow
chmod 755 wow

$ ./wow 
WOW
Fleck
user>

Would that work for you as a temporary solution?

from flk.

chr15m avatar chr15m commented on July 28, 2024

Docs here: https://github.com/chr15m/flk#compile

from flk.

chr15m avatar chr15m commented on July 28, 2024

@charlespwd since the fix for #3 I now see the following when I do this:

$ ./shebangtest
Error: "'#!/usr/bin/env' not found"

So maybe this is what was happening to you above but the error was getting swallowed?

This error is flk itself getting confused by the shebang and is something we could/should fix.

There seems to be some inconsistency with regards to nested shebangs - can I ask what OS you are on?

from flk.

charlespwd avatar charlespwd commented on July 28, 2024

Sure, I'm on arch linux 5.3.13-arch1-1.

Would we have a #!/usr/bin/env in the middle of the file if we merge them like you said eariler? Especially since lisp/clojure doesn't use # as a comment.

Could simply write the script without the leading shebang though 🤔.

from flk.

chr15m avatar chr15m commented on July 28, 2024

That #!/usr/bin/env already happens because of the way mal compiles the scripts together but it's not a problem. I think the fix for this is to get fleck to special-case parsing the first line of the file if it's a shebang and ignore it. Will investigate further.

from flk.

chr15m avatar chr15m commented on July 28, 2024

@charlespwd thank you very much for testing.

from flk.

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.