Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

JIRA/Atlassian CLI - escape ampersand problem

Robert Poldervaart February 4, 2014

I need to update a bunch of filters and am writing JIRA/Atlassian CLI commands to do this with the 3.8.0 updateFilter action. I'm using backslash \ to escape all the double quotes, but it is complaining about ampersands &. For example:

C:\Users\rpold>"C:\Program Files (x86)\Atlassian\atlassian-cli-3.8.0\jira.bat" --action  updateFilter 
--search "project not in ("R&D", rndti, \"Service Packs\", ToBeDeleted)affectedVersion = \"Vers 14\" 
AND status not in (closed) AND issuetype in (bug, \"Change Request\") AND created >= \"2013/07/01\"" --id 19066

I've tried R\&D and other attempts, but cannot seem to get it to accept the ampersand. If I take out the & and make it RnD, then it works. Any ideas?

Thanks! Robert

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 4, 2014

You didn't escape the double quotes in "R&D".

Robert Poldervaart February 4, 2014

Thanks for the reply, Bob. That was my typo in the question. I've simplified the text and will copy / paste exactly. It's still giving me grief about the ampersand. And BTW, if it wasn't obvious, I'm running on Windows 7.

C:\Users\rpoldervaart>"C:\Program Files (x86)\Atlassian\atlassian-cli-3.8.0\jira.bat" --action updateFilter --search "su
mmary ~ \"R&D\"" --id 19066
This function requires a non-blank value for either id or filter parameters.
'D\""' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\rpoldervaart>"C:\Program Files (x86)\Atlassian\atlassian-cli-3.8.0\jira.bat" --action updateFilter --search "su
mmary ~ \"R\&D\"" --id 19066
This function requires a non-blank value for either id or filter parameters.
'D\""' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\rpoldervaart>"C:\Program Files (x86)\Atlassian\atlassian-cli-3.8.0\jira.bat" --action updateFilter --search "su
mmary ~ \"RandD\"" --id 19066
Paradigm 2014 - Reported Issues filter with id: 19066 updated.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2014

Well, I had to boot my Windows environment to check it out. Mine seems to work fine with your first one. I don't want to get into Window's command shell differences, so, just simplify by using 'R&D' instead. JIRA seems to treat that as equivalent to using double quotes in jql. And if the & still causes problems, try escaping with a Windows escape for &, see http://www.robvanderwoude.com/escapechars.phpand try ^& to escape.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 5, 2014

Good :). Differences in command shells, quoting, multiple sets of escaping rules, enough to make one go insane if one isn't already :).

Robert Poldervaart February 5, 2014

Thanks for that. You are right. It is Dos/Windows that is causing the problem. I still couldn't get it to go through with the first attempt with \"R&D\", however, I am able to make it work with 'R&D'. I also found it to work with putting double quotes around the ampersand, as \"R"&"D\".

Thanks again, and sorry for the question when it really wasn't related to your CLI plug-in. And thanks for the plug-in!! Very useful.

TAGS
AUG Leaders

Atlassian Community Events