开发者

Call system to paste file together

file = ["file1","file2",...].join(" ")

`paste "#{file}"`

Hello, 开发者_如何学CI have this simple problem that has been bugging me for days. I want to use Ruby to select files to paste together, but when I use the above code, it returns saying that files are not found. If I run for a single file, e.g. paste file1, it works. Does someone see why the code isn't working?

Thanks in advance


It's because you quote #{file}. The thing that is executed is paste "file1 file2".

You probably want paste #{file} which would result in paste file1 file2. In your case, paste expects a file that is called "file1 file2" (filename with a space).

In other words, remove the double quotes in your second line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜