Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement more special shell-like functionality in backticks #20401

Open
StefanKarpinski opened this issue Feb 2, 2017 · 2 comments
Open

implement more special shell-like functionality in backticks #20401

StefanKarpinski opened this issue Feb 2, 2017 · 2 comments
Assignees
Labels
cmd Relates to calling of external programs

Comments

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Feb 2, 2017

Implement the following kinds of constructions in backticks using standard shell syntax:

  • pipeline construction: `grep foo /usr/share/dict/words | wc -l` => pipeline(`grep foo /usr/share/dict/words`, `wc -l`)
  • file redirection: `echo hello > file.txt` => pipeline(`echo hello`, "file.txt"), including append mode with >>, input with <, etc.
  • command generation with { }: `{a,b}.{c,d}` => `a.c a.d b.c b.d`
  • tilde expansion?
  • globbing?

This stuff is all currently possible, but the API for it is a bit hard to remember. This will effectively implement a portable shell-like language inside of backticks, which translates to a Julia implementation backed by libuv. It avoids most of the complexity of shells as languages since it's embedded in a full-fledged programming language (Julia).

@bramtayl
Copy link
Contributor

bramtayl commented Feb 7, 2017

What about a new method for |>?

|>(a::Cmd, b::Cmd) = pipeline(a, b)

@StefanKarpinski
Copy link
Member Author

StefanKarpinski commented Feb 7, 2017

Been there, done that. tl;dr: |> does not generalize well to all the kinds of redirection one needs for command pipelines – giving this monster a bit of syntax only makes it hungry for more, all of which is pretty badly punny. Using standard shell syntax inside of backticks makes using syntax unproblematic since it confines the scope of its meaning to the context of backticks.

@JeffBezanson JeffBezanson modified the milestones: 2.0+, 1.0 May 2, 2017
@StefanKarpinski StefanKarpinski modified the milestones: 2.0, 1.x Jan 22, 2019
@DilumAluthge DilumAluthge removed this from the 1.x milestone Mar 13, 2022
@brenhinkeller brenhinkeller added the cmd Relates to calling of external programs label Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd Relates to calling of external programs
Projects
None yet
Development

No branches or pull requests

5 participants