Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST/GET command not found when used in Bash script #84

Open
benbelgium opened this issue Sep 25, 2018 · 1 comment
Open

POST/GET command not found when used in Bash script #84

benbelgium opened this issue Sep 25, 2018 · 1 comment

Comments

@benbelgium
Copy link

benbelgium commented Sep 25, 2018

Hi Micha

First of all thank you for developing resty.

I'm trying to write a bash file to automatically execute some steps, but if I execute each command in a terminal everything works fine, but in bash all my POST/GET commands fail with the message command not found....

I read up online about PATH settings that could be causing this, I read on github the examples and everything seems perfect to me, and still it's not working....

#!/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

source /sbin/resty 'http://abu/api'

POST /login '{"username" : "report", "password" : "XXXXXXXX"}' | jshon -e auth_token -u

I added the PATH manually just to make sure it's correct, and for security reasons I replaced the real password with XXXX
If I would execute ./checkben.sh the output would be:

./checkben.sh: line 11: POST: command not found
warning: nothing to read

If I would execute each command manually at the terminal the output would be:

djA6MDUwNzc3MzMtZjg5OC00YTdiLWI2OGQtNGUzMDgzMjg5ODVhOjM3Oi91c3IvYnAvbG9ncy5kaXIvZ3VpX3JlcG9ydC5sb2c6MA==

Which is EXACTLY what I needed, so it is working fine at the terminal prompt....

@broerman
Copy link

broerman commented Feb 6, 2019

Try to expand aliases in the shell.
This works for me.

#!/bin/bash
shopt -s expand_aliases

Bernd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants