Executing shell command from ROOT session and from a macro

Hi all,

I’d like to rename a file from my ROOT macro. Manuals say it can be done with

but it works only if I’m in a ROOT session:

[someone@somewhere]~% root -l
root [0] .!ls
root [1] .! mv abc.txt def.txt
root [2] .!ls
root [3] .q

When I do the same in a macro it asks for ‘;’ at the end of the line, and them still complains about

and doesn’t rename my file.

What am I doing wrong and what’s the correct way to execute shell commands from a macro?

Thank you!

gSystem->Exec(“mv abc.txt def.txt”);

Wow, that was fast and it works! Thanks!