How do I preserve single and double quotes in a Bamboo command?

I'm trying to write a command that has both single and double quotes in the arguments.  The argument line that works in bash looks like this:

options ' othercommand to "servicename" '

(don't need the spaces with the single quotes - they're just there for visibility)

When I put this in Bamboo's argument line the single quotes drop out.  How can I get this to work?

3 answers

This widget could not be displayed.

Hello Obilo,

Thank you for your question.

In order to provide you a better assistance, could you please:

  • inform the command you are attempting on running in Bamboo
  • attach a screenshot from "Command configuration"

Kind regards,
Rafael P. Sperafico
Atlassian Support

This widget could not be displayed.

I don't think this will help you, but ...

The command is "winexe".

image2015-4-16 14:8:45.png

This widget could not be displayed.

Hello Obilo,

Thank you for the screenshot provided.

I have installed winexe on Linux and ran the following command from Terminal:

# command
winexe -U 'Administrator%mypassword' //192.168.10.101 'cmd.exe /c echo "this is running on windows"'
 
# response
"this is running on windows"

In Bamboo, I have created two tasks (Script and Command):

Screen Shot 2015-04-16 at 4.26.52 PM.png

Here is the build result:

Screen Shot 2015-04-16 at 4.34.48 PM.png

simple	16-Apr-2015 15:23:33	Build Project - Command - Default Job #2 (PROJ-COM-JOB1-2) started building on agent Default Agent
simple	16-Apr-2015 15:23:33	Build working directory is /opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir/PROJ-COM-JOB1
simple	16-Apr-2015 15:23:33	Executing build Project - Command - Default Job #2 (PROJ-COM-JOB1-2)
simple	16-Apr-2015 15:23:33	Running pre-build action: VCS Version Collector
simple	16-Apr-2015 15:23:33	Starting task 'Script' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'
command	16-Apr-2015 15:23:33	Beginning to execute external process for build 'Project - Command - Default Job #2 (PROJ-COM-JOB1-2)'\n ... running command line: \n/bin/sh /opt/atlassian/service/atlassian-bamboo-5.8.1/temp/PROJ-COM-JOB1-2-ScriptBuildTask-3971802775912516610.sh\n ... in: /opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir/PROJ-COM-JOB1\n ... using extra environment variables: \nbamboo_resultsUrl=http://192.168.10.176:8085/browse/PROJ-COM-JOB1-2\nbamboo_dependenciesDisabled=false\nbamboo_build_working_directory=/opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir/PROJ-COM-JOB1\nbamboo_buildKey=PROJ-COM-JOB1\nbamboo_shortPlanName=Command\nbamboo_agentWorkingDirectory=/opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir\nbamboo_buildNumber=2\nbamboo_shortJobName=Default Job\nbamboo_buildResultsUrl=http://192.168.10.176:8085/browse/PROJ-COM-JOB1-2\nbamboo_capability_system_jdk_JDK=/usr/java/jdk1.8.0_25\nbamboo_agentId=131073\nbamboo_planName=Project - Command\nbamboo_shortPlanKey=COM\nbamboo_ManualBuildTriggerReason_userName=admin\nbamboo_shortJobKey=JOB1\nbamboo_capability_system_jdk_JDK_1_8_0_25=/usr/java/jdk1.8.0_25\nbamboo_buildTimeStamp=2015-04-16T15:23:33.558-04:00\nbamboo_capability_system_builder_mvn3_Maven_3=/opt/apache-maven-3.0.4\nbamboo_capability_system_builder_command_Winexe=/usr/bin/winexe\nbamboo_working_directory=/opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir/PROJ-COM-JOB1\nbamboo_planKey=PROJ-COM\nbamboo_capability_system_jdk_JDK_1_8=/usr/java/jdk1.8.0_25\nbamboo_buildResultKey=PROJ-COM-JOB1-2\nbamboo_buildPlanName=Project - Command - Default Job\n
build	16-Apr-2015 15:23:34	"this is running on windows"
simple	16-Apr-2015 15:23:34	Finished task 'Script' with result: Success
simple	16-Apr-2015 15:23:34	Starting task 'Command' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.command'
command	16-Apr-2015 15:23:34	Beginning to execute external process for build 'Project - Command - Default Job #2 (PROJ-COM-JOB1-2)'\n ... running command line: \n/usr/bin/winexe -U Administrator%mypassword //192.168.10.101 cmd.exe /c echo "this is running on windows"\n ... in: /opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir/PROJ-COM-JOB1\n ... using extra environment variables: \nbamboo_resultsUrl=http://192.168.10.176:8085/browse/PROJ-COM-JOB1-2\nbamboo_dependenciesDisabled=false\nbamboo_build_working_directory=/opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir/PROJ-COM-JOB1\nbamboo_buildKey=PROJ-COM-JOB1\nbamboo_shortPlanName=Command\nbamboo_agentWorkingDirectory=/opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir\nbamboo_buildNumber=2\nbamboo_shortJobName=Default Job\nbamboo_buildResultsUrl=http://192.168.10.176:8085/browse/PROJ-COM-JOB1-2\nbamboo_capability_system_jdk_JDK=/usr/java/jdk1.8.0_25\nbamboo_agentId=131073\nbamboo_planName=Project - Command\nbamboo_shortPlanKey=COM\nbamboo_ManualBuildTriggerReason_userName=admin\nbamboo_shortJobKey=JOB1\nbamboo_capability_system_jdk_JDK_1_8_0_25=/usr/java/jdk1.8.0_25\nbamboo_buildTimeStamp=2015-04-16T15:23:33.558-04:00\nbamboo_build_commandline_com_atlassian_bamboo_plugins_scripttask_task_builder_script_1=/bin/sh /opt/atlassian/service/atlassian-bamboo-5.8.1/temp/PROJ-COM-JOB1-2-ScriptBuildTask-3971802775912516610.sh\nbamboo_capability_system_builder_mvn3_Maven_3=/opt/apache-maven-3.0.4\nbamboo_capability_system_builder_command_Winexe=/usr/bin/winexe\nbamboo_working_directory=/opt/atlassian/home/bamboo-5.8.1/xml-data/build-dir/PROJ-COM-JOB1\nbamboo_planKey=PROJ-COM\nbamboo_capability_system_jdk_JDK_1_8=/usr/java/jdk1.8.0_25\nbamboo_buildResultKey=PROJ-COM-JOB1-2\nbamboo_buildPlanName=Project - Command - Default Job\n
build	16-Apr-2015 15:23:35	"this is running on windows"
simple	16-Apr-2015 15:23:35	Finished task 'Command' with result: Success
simple	16-Apr-2015 15:23:35	Running post build plugin 'npm Cache Cleanup'
simple	16-Apr-2015 15:23:35	Running post build plugin 'NCover Results Collector'
simple	16-Apr-2015 15:23:35	Running post build plugin 'Clover Results Collector'
simple	16-Apr-2015 15:23:35	Running post build plugin 'Docker Container Cleanup'
simple	16-Apr-2015 15:23:35	Running post build plugin 'Artifact Copier'
simple	16-Apr-2015 15:23:35	Finalising the build...
simple	16-Apr-2015 15:23:35	Stopping timer.
simple	16-Apr-2015 15:23:35	Build PROJ-COM-JOB1-2 completed.
simple	16-Apr-2015 15:23:35	Running on server: post build plugin 'NCover Results Collector'
simple	16-Apr-2015 15:23:35	Running on server: post build plugin 'Clover Delta Calculator'
simple	16-Apr-2015 15:23:35	Running on server: post build plugin 'Maven Dependencies Postprocessor'
simple	16-Apr-2015 15:23:35	Running on server: post build plugin 'Build Hanging Detection Configuration'
simple	16-Apr-2015 15:23:35	All post build plugins have finished
simple	16-Apr-2015 15:23:35	Generating build results summary...
simple	16-Apr-2015 15:23:35	Saving build results to disk...
simple	16-Apr-2015 15:23:35	Indexing build results...
simple	16-Apr-2015 15:23:35	Finished building PROJ-COM-JOB1-2.

As you can notice, Bamboo executes the winexe command successfully.

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in Statuspage

What are your best incident management tips and stories? #HugOps

 👋Community members! Downtime happens. And great incident response takes a village. Teams like Support, Dev, SRE, Ops, IT, and Marketing have to come together to resolve the problem while keep...

33 views 2 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you