def self.should_run_under_cmd?(command)
return true if command =~ /^@/
quote = nil
env = false
env_first_char = false
command.dup.each_char do |c|
case c
when "'", '"'
if (!quote)
quote = c
elsif quote == c
quote = nil
end
next
when '>', '<', '|', '&', "\n"
return true unless quote
when '%'
return true if env
env = env_first_char = true
next
else
next unless env
if env_first_char
env_first_char = false
env = false and next if c !~ /[A-Za-z_]/
end
env = false if c !~ /[A-Za-z1-9_]/
end
end
return false
end