Please help, I am stuck here —
irb> a = 'line of text\n line two\n line three' irb> system('cat > test_file << #{a}') cat: of: No such file or directory cat: text: No such file or directory => false
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 need to quote the interpolated parameter:
And, cat is expecting a filename, not some text to append to test_file, so, this would work as I think you intended:
If you want to do this in pure Ruby let me know and I’ll give you an example.