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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,779
Community Members
 
Community Events
176
Community Groups

bash: jq:command not found

I am working on bitbucket pipelines using javascript/nodejs as the language.

I need 'jq' command in my script but it throws error of jq: command not found

Below is my bitbucket pipelines.yml file

 

jq.JPG

3 answers

1 accepted

1 vote
Answer accepted

Hi @nazia_akhtar ,

Thank you for your question!

You can add it with the next command before using jq:

apt-get install -y jq

jq error.PNG

Hi this is part of a script I am running to attach an image to a page. However, I am getting these errors:

line 10: jq: command not found

line 12: [: =: unary operator expected

Line 10 is ATTACHMENT_TITLE=$(curl -u $USER_NAME:$USER_PASSWORD \ -X POST \ -H "X-Atlassian-Token: nocheck" -F "file=@${ATTACHMENT_FILE_NAME}" -F "comment=File attached via REST API" \ ${CONFLUENCE_BASE_URL}/rest/api/content/${PAGE_ID}/child/attachment 2>/dev/null \ | jq -r '.results[].title')

Line 12 is if [ ${ATTACHMENT_TITLE} = ${ATTACHMENT_FILE_NAME} ]; then

Am not sure what is causing this error as I got this script from an atlassian page. Please let me know how I can fix and run this?

 

image: node:10.15.3
pipelines:
default:
- step:
name: "prova default"
script:
- echo "Deploying version is $VERSIONRELEASE"
- ls
- mkdir build
- touch build/test.json
- ls build
- apt-get install -y jq
- declare -x VERSION=$(jq -r '.version' package.json)
- echo "package.json version is $VERSION"



+ apt-get install -y jq
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package jq

 

sorry, but does not work

Hi Luca,

I had the same issue.

Before you can install jq, you have to make an "apt-get update"

Example:

- apt-get update 
- apt-get -y install jq
Like Shailesh Gupta likes this
 apt-get update  this part is required

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events