Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

curl command work in terminal but not in .sh script

Manish Amatya August 25, 2020

when i run following command on terminal it works and post value the the issue but when i run the same command from .sh script file it doesnt work and gives out error 

curl --insecure -u "username":$cat(password.txt) -X PUT --data '{"fields" : {"customfield_10301" : "value"} }' -H "Content:application/json" https://url/rest/api/2/issue/(issueid)

 

it give following error

 

cat password.txt command not found

curl --insecure -u "username":$cat(password.txt) -X PUT --data '{"fields" : {"customfield_10301" : "value"} }' -H "Content:application/json" https://url/rest/api/2/issue/(issueid : No such file or directory

Answer

1 answer

0 votes
Dibyandu Roy
Contributor
August 26, 2020

I would suggest to put the absolute that for password.txt in shell script.

For Eg: if the password.txt is present in /opt/atlassian/jira/password.txt then put $cat(/opt/atlassian/jira/password.txt) in shell script.

Manish Amatya August 26, 2020

I tried that,for example if my password is password123 the cat command will show my password on resuly but at the end same thing no such file or directory

 

curl --insecure -u "username":password123 -X PUT --data '{"fields" : {"customfield_10301" : "value"} }' -H "Content:application/json" https://url/rest/api/2/issue/(issueid : No such file or directory

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events