Home > OS >  Unable to get value from bashrc when Echoing
Unable to get value from bashrc when Echoing

Time:01-31

Good Day Everyone,

I am currently having some difficulty setting my environment variables, I am currently using a mac as well.So, I am not a PHP user so I do not know much about the language. However, I have a few variables that I stored in my bashrc file.

I would like to retrieve them, and use it as part of my current project workflow (GIT Token).

I have a few variables stored, but it will not return any value... I am really not sure what is wrong. Please do assist me..

nano ~/.bashrc

export GITHUB_TOKEN= ghp_123456
export testVal = Testing

However when I call nothing happens

echo $testval

And when downloading a private repo it shows this error..

curl -sSfL -H "Authorization: token ${GITHUB_TOKEN?not set}" -H 'Accept: application/rnd.github.v2.raw' "https://eg.git" | sh -s --

bash: GITHUB_TOKEN: not set

CodePudding user response:

Remove the spaces between the equals sign, like this:

export GITHUB_TOKEN=ghp_123456
export testVal=Testing

When writing var = value you're asking the shell to open program var with = and value as arguments.

  • Related