Giter Club home page Giter Club logo

Comments (4)

ezrizhu avatar ezrizhu commented on June 23, 2024 1

I don't have a better idea, feel free to delete the branch. I'll close the issue once the docs has been updated.

from try.

mgree avatar mgree commented on June 23, 2024

The solution is to appropriately quote when we generate $script_to_execute. A basic version of this would not be too hard, but subtleties of escaping abound.

Would be easily resolved in a rewrite not in the shell.

from try.

mgree avatar mgree commented on June 23, 2024
for arg in "$@"
do
    case $arg in
        (*[$(printf " \n\t()<>&;|\`?*\$\"'")\\]*)
          quoted=$(echo "$arg" | sed -e "s/'/'\\\\''/")
          printf "'%s' " "$quoted";;
        (*)   printf "%s " "$arg";;
    esac
done
printf "\n"

is a workable first cut.

from try.

mgree avatar mgree commented on June 23, 2024

Our tests expect that try "echo hi>foo" will preserve the redirect and that try "echo hi; echo bye" will preserve the pair of commands.

I don't see how we can support both this existing behavior and appropriate quoting of things like bash -c. An advantage of the current behavior is that you can run try "bash -c \"echo hi\"" and get the right behavior... whereas it's not clear how to preserve the shell syntax with this modified behavior.

Unless you have a better idea, I'll delete the branch and close the issue.

from try.

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.