workflow plugin: how to execute shell command with quoted arguments?

63 views
Skip to first unread message

Alexander Uvizhev

unread,
May 19, 2015, 11:38:18 AM5/19/15
to jenkins...@googlegroups.com
I need to execute shell command with quoted argument like this:
myexecutable 'argument'
That's because argument can be interpreted wrong in some cases e.g. "-input_value_looking_like_param".
Seems like 'sh' wipes all quotes in command string no matter what types of escaping I tried.
Is there a way?

Alexander Uvizhev

unread,
May 19, 2015, 11:40:32 AM5/19/15
to jenkins...@googlegroups.com
To be clear what I try to do is:
sh"myexecutable 'argument'"



вторник, 19 мая 2015 г., 18:38:18 UTC+3 пользователь Alexander Uvizhev написал:

Baptiste Mathus

unread,
May 19, 2015, 11:58:12 AM5/19/15
to jenkins...@googlegroups.com

Cannot try just now. But wild guess: as this is groovy, you may want to try triple quoting (just use """ instead of one ") the outside expression. Not sure it will work though since what you did already looks correct to me.

My 2 cents

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e5beb569-8bdd-4058-a779-0cb86180b59f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Uvizhev

unread,
May 19, 2015, 12:25:05 PM5/19/15
to jenkins...@googlegroups.com, m...@batmat.net
Thanks for your reply but that doesn't work either. 

вторник, 19 мая 2015 г., 18:58:12 UTC+3 пользователь Baptiste Mathus написал:

Jesse Glick

unread,
Jun 16, 2015, 2:45:54 PM6/16/15
to jenkins...@googlegroups.com
On Tuesday, May 19, 2015 at 11:40:32 AM UTC-4, Alexander Uvizhev wrote:
To be clear what I try to do is:
sh"myexecutable 'argument'"

node {
  sh "echo 'works fine'"
}

Works for me. Without a complete, self-contained script it is hard to say where you got it wrong (or whether there is a genuine bug in some corner case).
Reply all
Reply to author
Forward
0 new messages