If I have a BASH script, like this:
#!/bin/bash
cp file1.txt file2.txt
Can I add source code from other languages, such as Lua or Ruby inside the BASH script, stored in the same file?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you could embed the source in a “here document” (search the manpage for that string), and at runtime of the bash script, create the scripts in /tmp or wherever you wish to execute them; alternatively, you could pipe the “here document” to the scripting engines if they accept input from stdin.
I don’t know enough Ruby or Lua, but here’s some Python via Bash: