You can run Ruby code from a bash shell script. In this case, you will have one bash script and a Ruby script. You can simply call the Ruby script from within the Bash shell script.
If you want to combine both scripts in one script, then we will need to use the << heredoc functionality of Bash shell.
Let's write the embed_03.sh script:
#!/usr/bin/env sh echo "This is bashScript!" /usr/bin/env rubyScript <<-EndOfRuby puts 'This is ruby!' EndOfRuby
Let's test the program:
$ chmod +x embed_03.sh $ ./ embed_03.sh
The output is as follows:
This is bashScript! This is rubyScript!