[input] testcase: ab: 1 AB: 2
[error ouput at job.sh] run_test ab=1 _65__66_=2 ...
[how] pry(main)> key="AB" => "AB" pry(main)> key.gsub(/[^a-z0-9_]/) { |m| '_' + m.getbyte(0).to_s +'_' } => "_65__66_" pry(main)> key.gsub(/[^a-zA-Z0-9_]/) { |m| '_' + m.getbyte(0).to_s+ '_' } => "AB"
Signed-off-by: Wei Jihui weijihuiall@163.com --- lib/job2sh.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/job2sh.rb b/lib/job2sh.rb index 82ec7d24..e058483d 100755 --- a/lib/job2sh.rb +++ b/lib/job2sh.rb @@ -20,7 +20,7 @@ def valid_shell_variable?(key) end
def shell_encode_keyword(key) - key.gsub(/[^a-z0-9_]/) { |m| '_' + m.getbyte(0).to_s + '_' } + key.gsub(/[^a-zA-Z0-9_]/) { |m| '_' + m.getbyte(0).to_s + '_' } end
def shell_escape_expand(val)