I am trying to do something like this
ruby test.rb | source /dev/stdin
where test.rb just prints out cd /
. There are no errors, but it doesn't do anything either. If I use this:
ruby test.rb > /tmp/eraseme2352; source /tmp/eraseme2352
it works fine, but I want to avoid the intermediate file.
Edit: The whole point of this is that the changes need to persist when the command is done. Sorry I didn't make that clearer earlier.
You can try:
$(ruby test.rb)
$(...)
tells bash to execute whatever output is produced by command inside ()
.
eval `ruby test.rb`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With