Skip to content

FAQ entry on shell metacharacters in run#43633

Merged
JeffBezanson merged 6 commits intomasterfrom
stevengj-patch-3
Jan 5, 2022
Merged

FAQ entry on shell metacharacters in run#43633
JeffBezanson merged 6 commits intomasterfrom
stevengj-patch-3

Conversation

@stevengj
Copy link
Copy Markdown
Member

@stevengj stevengj commented Jan 2, 2022

I feel like we are answering the same question over and over on support for shell characters like * and | in run (see e.g. here and here and here and here, and it would be nice to have a succinct FAQ entry to point people to.

@stevengj stevengj added docs This change adds or pertains to documentation cmd Relates to calling of external programs labels Jan 2, 2022
@DilumAluthge
Copy link
Copy Markdown
Member

Needs a whitespace fix.

@Seelengrab
Copy link
Copy Markdown
Contributor

IMO, we shouldn't suggest run(`sh -c "..."`) as a "workaround" to not having native piping/IO redirection in cmd literals and instead directly insert e.g. run(pipeline(`ls`, "out.txt")) here. It's safer, as it doesn't go through a shell for actual shell evaluation, thereby losing safety advantages granted by cmd literals in the first place.

@stevengj
Copy link
Copy Markdown
Member Author

stevengj commented Jan 3, 2022

It's not suggested as a "workaround" (that word is not used!). The FAQ entry heavily recommends using pipeline and Glob.jl, and emphasizes the downsides of the shell. But I think it's also important to say that sh -c "..." is what functions like os.system("...") are really doing in other languages, and of course you can do that too in Julia if you want.

But I'll edit it to include the Julia-native version.

@JeffBezanson JeffBezanson merged commit b9432a8 into master Jan 5, 2022
@JeffBezanson JeffBezanson deleted the stevengj-patch-3 branch January 5, 2022 21:16
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 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 docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants