Score:0

Add curl command to function for bash profile

br flag

How do I add this command as an alias or function to my bash_profile?

curl -X GET -H "x-api-key:xxxxxxxxxxxxxx" -H "Content-Type: application/json"  https://xxxxxxx.amazonaws.com/api/ | jq

I tried this:

my-func () { curl -X GET -H "x-api-key:xxxxxxxxxxxxxx" -H "Content-Type: application/json"  https://xxxxxxx.amazonaws.com/api/ | jq; }

I get the following error when trying to add as an alias or use in a function.

-bash: `${
  "message": "Missing Authentication Token"
}': not a valid identifier
Score:0
do flag

Edit the file ".bashrc" of your user :

  • /root/.bashrc for root user
  • /home/user/.bashrc for user

You have examples of alias in it :)

nipy avatar
br flag
Checked on my Mac and I don't see this.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.