*"We want [Julia to be] **as good at gluing programs together as the 
shell."* -- http://julialang.org/blog/2012/02/why-we-created-julia

I've been using the bash shell (or tcsh, sh etc) every day since before the 
time that my 2400-baud modem was a big upgrade.

I was thinking...  What would it take to use the Julia REPL as a day to day 
replacement for bash?

(I don't know if this is a sensible thing to do, but why not...)

For me, vi key bindings would be a must 
<https://github.com/JuliaLang/julia/issues/6774> but more generally, maybe 
it would be good to have:

   - a mechanism like Tcl's <https://www.tcl.tk/man/tcl/TclCmd/unknown.htm>
   unknown <https://www.tcl.tk/man/tcl/TclCmd/unknown.htm> so that commands 
   that are not valid julia can be passed off to the normal shell.
   e.g. the interactive tcl shell accepts both tcl commands and shell 
   commands

$ tclsh

% puts "hello"

hello

% gcc --version

Apple LLVM version 7.0.0 (clang-700.1.76)

Target: x86_64-apple-darwin15.0.0

Thread model: posix


(the current REPL shell mode is nice but the extra keystroke seems to make 
it a 2nd class thing, but maybe I'm just lazy)


   - some shell-like julia functions designed to work nicely with command 
   pipelines.
   e.g. 

grep(p::Regex) = (x->filter(i->ismatch(p,string(i)),x))

grep(p::AbstractString) = grep(Regex(p))


names(Base) |> grep("^read") |> length


   -  a way to mix shell commands with jl commands
   
e.g. maybe something like ...

 

bash(cmd) = map(chomp, readlines(`bash -c $cmd`))

macro s_str(s) bash(s) end
m(f) = i->map(f,i)

 

s"ps -ax" |> grep("julia") |> m(split) |> m(i->i[1])


or


split(a::Array) = map(split, a)

s"ps -ax" |> grep("julia") |> split |> m(i->i[1])

 

 Has anyone worked on anything along these lines?

 

   

   

   

   

   

   

Reply via email to