We can use shell commands in ROOT, by prepending the commands with “.!”. Piping and stuff works as well, which is wonderful. However, I wonder how can we mix regular ROOT - I’m sure I’m just forgetting the proper phrase - and shell commands in a single line.
Basically, how can I get something like .! _file0->ls() | grep exp to work? I’ve tried various permutations and all of them makes either sh or the interpreter scream.
Hi,
I think ROOT’s .! is “dumber” than you think: it just takes whatever commands you write after it and executes them in a shell (spawned as a subprocess if I’m not mistaken). Something like .! _file0->ls() | grep exp would require that what you put after .! is parsed to check which parts look like C++ and which parts look like bash…I’m not even sure it’s possible in general.
Something you can do is the following, from your terminal: