Why will I call the bash command from Ruby?

I am trying to use Ruby to execute the following bash commands on some images:

class Pingcrush
def initialize
Dir.foreach('drawable') do |item|
next if item =='.' or item =='..'
# do work on real items
if item.end_with?(".png") then
%x["wine pngcrush.exe -brute drawable/#{item} new/#{item}"]
end
end
end
end
Pingcrush.new

The directory I am in is the parent directory of drawable and new, but when I try to run the script, I always get The same error:

sh: wine pngcrush.exe -brute drawable/feed_cl.png new/feed_cl.png: not found

Why is this? I tried to switch the path I called in Ruby, and it seems I can’t make it work.

It executes you Shell but can’t find wine. Try to set the full path to install wine.

which wine

I am trying to use Ruby to execute the following bash commands on some images:

class Pingcrush
def initialize
Dir.foreach('drawable ') do |item|
next if item =='.' or item =='..'
# do work on real items
if item.end_with?(".png" ) then
%x["wine pngcrush.exe -brute drawable/#{item} new/#{item}"]
end
end
end
end
Pingcrush.new

The directory I am in is the parent directory of drawable and new, but when I try to run the script, I always get the same error:

sh: wine pngcrush.exe -brute drawable/feed_cl.png new/feed_cl.png: not found

Why is this? I tried to switch the path I called in Ruby, and it seems I can’t make it work.

It executes your shell but can’t find wine. Try to set up and install wine The full path.

which wine

Leave a Comment

Your email address will not be published.