I would like to know how to run ruby commands in ruby on rails console inside a shell script ? To be clear: I have a shell script which will connect to ruby on rails console, but unable to run commands inside the rails console from shell script. Please see below code snippet.
I am successfully able to enter into rails console from shell script, but unable to provide ruby commands inside shell script itself.
This sample script is allowing me to enter into rails console:
#!/bin/bash
/usr/bin/helpkit-docker.sh --rails-console
But, when i extend the above script to run commands inside rails console using EOF, it throws error:
#!/bin/bash
/usr/bin/helpkit-docker.sh --rails-console <<EOF
Time.now.strftime("%d/%m/%Y %H:%M")
EOF
Error: the input device is not a TTY
I expect the time to be fetched from rails console and get displayed in shell terminal