Here is the code do.rb:
#!/usr/bin/ruby
def open
fp = File.open("input")
yield fp
fp.close
end
open do |fp|
while line = fp.gets
puts `du #{line} -h`
# puts `du -h #{line}` # this works fine
end
end
And the input file:
1.rb
2.rb
If I run ruby do.rb, it just returns a command not found.
And I have to change -h before #{line}.
I don't why. Thanks.