Skip to content

Carets in script args require double-escaping on Windows #103

@rads

Description

@rads

Overview

On Windows, each bbin script has a .bat wrapper that interprets ^ in the args as an escape character. There appear to be two levels of escaping because you need to write ^^^^ to pass a single ^ to the bbin script. This problem doesn't happen on macOS/Linux because zsh and bash interpret ^ as a literal character.

I did a little research and I couldn't find an easy way to fix this while still keeping the .bat wrappers. I'm not sure how to fix this issue.

Steps to Reproduce

  1. Start with a script called foo.clj:
(prn *command-line-args*)
  1. Install the script:
$ bbin install foo.clj
  1. In zsh and bash, carets don't need to be escaped to be passed through:
    $ foo ^hello
    ("^hello")
    
    In PowerShell and cmd.exe, carets need to be escaped four times:
    $ foo ^hello
    ("hello")
    $ foo ^^hello
    ("hello")
    $ foo ^^^^hello
    ("^hello")
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions