How to call function in shell script from ruby (preferably using open3)
#!/bin/sh
# A simple script with a function...
function add()
{
echo "1"
}
Ruby Script that does not work--
#!/apollo/bin/env ruby
# -*- ruby -*-
require 'open3'
Open3.capture3('.\something.sh', 'add')
In the first place, you should have a valid bash function declaration.
Assuming
something.shwas corrected to:You have to load it’s content into current shell and execute a function in it: