在 shell 脚本中使用 Rails runner 显示命令运行的输出

the*_*ray 3 ruby shell ruby-on-rails sh

我正在编写一个可执行的 shell 脚本,该脚本使用rails runner 在rails 控制台中执行某些操作。如何查看 ruby​​ 命令的结果并将其打印到屏幕上。

我尝试使用 -v 来详细运行脚本,但我仍然无法看到发生了什么。

#!/bin/sh
sudo rails runner "Model.print_something"
Run Code Online (Sandbox Code Playgroud)

Ahm*_*mal 6

使用puts
sudo rails runner "puts Model.print_something"