Re: [julia-users] Recover lost script from active command line session
Thanks. I'll look into this. On Monday, July 11, 2016 at 8:06:31 AM UTC-4, Stefan Karpinski wrote: > > On the off chance that the file has been rm'ed but you still have a file > handle for it open in the process, you may be able to use lsof to find a > inode number from which you might be able to recover the file (maybe > through /proc on Linux?). Sorry, kind of vague, but it's just a thought. > > On Monday, July 11, 2016, David P. Sanders> wrote: > >> Type ctrl-R in the repl and start to type include. This will give you the >> last command by that name that you typed and will show you which file you >> included. You can do pwd() to show which directory you are working in. > >
Re: [julia-users] Recover lost script from active command line session
On the off chance that the file has been rm'ed but you still have a file handle for it open in the process, you may be able to use lsof to find a inode number from which you might be able to recover the file (maybe through /proc on Linux?). Sorry, kind of vague, but it's just a thought. On Monday, July 11, 2016, David P. Sanderswrote: > Type ctrl-R in the repl and start to type include. This will give you the > last command by that name that you typed and will show you which file you > included. You can do pwd() to show which directory you are working in.
Re: [julia-users] Recover lost script from active command line session
Thanks. Fortunately (or unfortunately) my functions were in a different script. I was able to recover some function inputs, but not the loops and change directory calls. I was hoping the entire script was cached somewhere accessible. On Monday, July 11, 2016 at 7:45:19 AM UTC-4, Mauro wrote: > > There might be better tricks, the best I know is that for any function > which was defined you can get to its AST: > > julia> f() = sin(5)+7 > > julia> Base.uncompressed_ast(f.env.defs.func.code) > :($(Expr(:lambda, Any[], Any[Any[],Any[],0,Any[]], :(begin # /tmp/t.jl, > line 2: > return (Main.sin)(5) + 7 > end > > If you have several methods use `next` until there are no more: > > julia> f(x) = x > f (generic function with 2 methods) > > julia> Base.uncompressed_ast(f.env.defs.next.func.code) > :($(Expr(:lambda, Any[:x], Any[Any[Any[:x,:Any,0]],Any[],0,Any[]], :(begin > # none, line 1: > return x > end > > I don't know about non-function code. > > On Mon, 2016-07-11 at 13:18, Christopher Fisher> wrote: > > I ran a script over the weekend. When I returned, the script ran and > saved > > the results correctly. However, for some inexplicable reason I cannot > find > > the script anywhere. I was wondering if it is possible to recover the > > script from my terminal session, which is still active. I used include( > ) > > to execute the script. > > > > Any help would be appreciated. > > > > Chris >
Re: [julia-users] Recover lost script from active command line session
There might be better tricks, the best I know is that for any function which was defined you can get to its AST: julia> f() = sin(5)+7 julia> Base.uncompressed_ast(f.env.defs.func.code) :($(Expr(:lambda, Any[], Any[Any[],Any[],0,Any[]], :(begin # /tmp/t.jl, line 2: return (Main.sin)(5) + 7 end If you have several methods use `next` until there are no more: julia> f(x) = x f (generic function with 2 methods) julia> Base.uncompressed_ast(f.env.defs.next.func.code) :($(Expr(:lambda, Any[:x], Any[Any[Any[:x,:Any,0]],Any[],0,Any[]], :(begin # none, line 1: return x end I don't know about non-function code. On Mon, 2016-07-11 at 13:18, Christopher Fisherwrote: > I ran a script over the weekend. When I returned, the script ran and saved > the results correctly. However, for some inexplicable reason I cannot find > the script anywhere. I was wondering if it is possible to recover the > script from my terminal session, which is still active. I used include( ) > to execute the script. > > Any help would be appreciated. > > Chris