Julia v1.0.0 - Semicolon and right-bracket prefixes not working in Jupyter notebook yet

I realize that there are bound to be issues with the latest release, and that I may not have set up everything correctly with the new Pkg system, but I was pleasantly surprised that I could

$ julia100 # my symlink for Julia v1.0.0
] add Plots
] add IJulia

(from Mac terminal), so I launched jupyter-notebook and it let me start a new notebook with the Julia 1.0.0 kernel! So I’m playing around. First thing I discovered was that the right-square-bracket prefix doesn’t work, but that’s no biggie because I can

import Pkg

etc. But the semicolon prefix, e.g.


seems to cause a kernel exception. Am I doing something wrong, or should I just wait for an update to Julia or the IJulia package?


Partial solution:


This still doesn’t answer my question, but at least I can run shell commands within the notebook using run().

You can run the Pkg REPL from the string macro:

using Pkg
pkg"add Example"



This is fixed in the latest IJulia version.

The ], analogous to the REPL pkg mode, is not yet supported, but as others have pointed out you can just call Pkg functions directly.

] support is forthcoming:


Thanks! I just updated and tested it.

BTW, is there a straightforward way to escape/quote wildcards/regex/special-chars in a system command? I’m used to using the bang (!) prefix in Matlab do run arbitrarily complex command lines, e.g.

>>  !ls -lrt *.dat | cat -n | tail -20

but haven’t figured out how to do this with Julia’s run, @cmd, or even using run(pipeline()). I get a warning about having to quote special characters, but I’m not sure how to do it. Any advice would be appreciated.

The whole point of run is that you are not using the shell, so you don’t have to quote weird characters, spaces, etcetera. See

You aren’t using the shell, however, so you have to use Julia’s pipeline function instead of | for piping. If you want globbing like *.dat, you can use the Glob.jl package to avoid the shell.

For example, your ls -lrt *.dat | cat -n | tail -20 example can be written

using Glob
run(pipeline(`ls -lrt $(glob("*.md"))`, `cat -n`, `tail -20`))

If you actually want to use the shell, you need to do something like run(`/bin/sh -c "ls -lrt *.dat | cat -n | tail -20"`) — the “shell” mode of ; uses run, it doesn’t actually pipe directly to /bin/sh or whatever shell.

1 Like

Actually, ; cmd does execute through the shell (https://github.com/JuliaLang/julia/pull/4635) unless that behavior was changed? But it still parses the string as a Cmd object first. I wonder if it would be better to just sling the whole string at the shell.

We used to. @jameson didn’t like it.

No, it never did that. At some point, I fixed a bug in escape, which people for some reason seemed to assume was intended behavior (the old code called shell_escape, but assumed that only the “intended” parts of the result are actually correctly escaped and the rest were somehow copied verbatim from the pre-parsed representation). Stevengj’s proposal has been noted before and, I think, still has merit: #10120. I somewhat recall implementing something more like this prior to the initial PR, but originally we eventually concluded it was better not to create a weird hybrid and instead make this just a simple pass-through to calling run (+ some magic for cd as a builtin). I’m not opposed to re-visiting that decision, although I like #20401 more.

(historical note: hilariously, we were strongly considering using ? as the character operator to invoke this. what a tragic mistake that would have been. we also considered using ] too, but decided that embedding a second language off that character would be bad because people might also want to try using it as the API for run in scripts – definitely an odd non-sequiter of a argument, but I guess we were younger then and more foolish. c.f. #3472)

What about just doing something simpler: passing the string after ; through to the shell unaltered? If you want to interpolate Julia variables etcetera you can use run.