rails console doesn't run scripts, why?

I'm trying to generate a controller (but I have this problem with
every script):

Loading development environment.

./script/generate controller Ciao

SyntaxError: compile error
(irb):1: syntax error, unexpected '.'
./script/generate controller Ciao
(irb):1: syntax error, unexpected tIDENTIFIER, expecting kDO or '{' or
./script/generate controller Ciao
        from (irb):1

How can I solve it?

Thanks so much. Since I don't understand much of ruby and rails, could
you point me to some interesting tutorials on how the console works?

And can you tell me the difference between ruby and rails? I mean,
when i start the console through script/console is that ruby or rails?
and how can I call IRB without rails?

Console is an interactive ruby (irb) session in which the rails
environment has already been loaded. irb (the normal interactive ruby)
is simply started with the irb command.

./script/generate controller Ciao

Console and irb are used to allow you to run ruby code interactively
(hence the name) so in the console this isn't a system call to the
generate script, it's just invalid ruby syntax.

For the record, you can use `` (backticks) or system() to enclose a
shell command that is executed with the STDOUT value given as the
return, ie:

`./script/generate controller Ciao`

But you wouldn't actually do this in practice. You would simply
execute ./script/generate controller Ciao in your shell as neongrau_

You can learn about ruby and irb in _why's poignant guide and the ruby
pickaxe, both available for free online. You can learn about console
in the README in your rails app, in various tutorials on the internet,
and in the Agile Web Development With Rails book by the Pragmatic
Programmers, which I recommend.