I often find myself using the fantastic
root -l -b -q -e 'std::cout << "Hello World!" << std::endl;' to quickly try things out or when debugging to quickly narrow down an issue.
However, I find it cumbersome to have to write the
-l -b -q -e part repeatedly when semantically I want to perform a single action (“Just print the result of the expression!”) as opposed to the 4 actions the required options suggest (“Print the result of the expression, but don’t use graphics, don’t show the splash screen, and please quit after the evaluation”).
Hence I propose to introduce the shorthand
root -E for this command. Thoughts?
-b could possibly be omitted from this discussion.
Note: Of course I can use a shell alias for this but this could be useful for people other than I as well
at least with unix a quick solution:
alias rex="root -n -l -b -q -e "
note I added -n, dont execute rootlogons
But what you propose would be very useful
it does not work in ROOT 5.34, rex 5./8 gives:
Warning in TApplication::GetOptions: macro 5./8 not found
thats correct, root 5 has no -e
But since 5 is frozen you wont get the above shortcut I guess
For fans of Root5:
Attached a little bash script which simulates the -e option of Root6.
Copy it to your bin directory, rename to rex5 and “chmod +x rex5”
Then you can do:
Dont forget the “” if the expression contains characters
eaten by the shell otherwise.
You see its pretty clumsy and probably not complete.
So another good reason to change to Root 6
rex5.txt (525 Bytes)
I take it then that while the shorthand can be useful, there is not enough motivation to spend development time integrating it into root6.
Thanks for the discussion!