All Questions
Tagged with quoting environment-variables
17
questions
6
votes
1
answer
3k
views
Getting jq error when using variable in command line
I am using jq to get the tag_name index with the script:
curl \
https://api.github.com/repos/checkstyle/checkstyle/releases \
-H "Authorization: token $GITHUB_TOKEN" \
-o /var/tmp/cs-...
0
votes
2
answers
124
views
Export directory in `bashrc` without having to quote the variable
Currently in my bashrc I export a variable export dl="path/to/Downloads". The path contains a space in it so whenever I mv something from the directory, I have to quote the dl variable such ...
5
votes
2
answers
22k
views
Environment Variables with $ Character [duplicate]
I'm using a MacOS. I tried to enter this environment variable inside my .bash_profile:
export CLOUD_PASSWORD=Pass4Aa$ditya
But when I do source .bash_profile and try echo $CLOUD_PASSWORD, I get this ...
0
votes
3
answers
2k
views
Which quoting style GNU Bash variable definitions (mostly for paths)? [closed]
Which of the following quoting styles, for GNU Bash variables, is preferred and why?
Two double quotes: VAR="/path/$V1/path with space/$V2".
Multiple double quotes: VAR=/path/"$V1"/"path with space"/"...
1
vote
2
answers
6k
views
Why is this environment variable not set up?
When a shell runs an external executable as a command, we can pass
environment variables into the executable.
$ var=3 /bin/echo `$var`
$ var=3 bash -c "/bin/echo '$var'"
both don't output anything.
...
4
votes
0
answers
293
views
How to explicitly set the tabname of a new gnome-terminal?
I want to explicity rename a tab in gnome-terminal on startup of the tab. I don't want to use gnome-terminal --title flag as that gets reset by my systems bashrc file after whatever else is supposed ...
4
votes
2
answers
3k
views
Why some commands don't load user environment when executed with ssh? (while other do)
On a target machine (OS X El Capitan) I have brew in /usr/local/bin. When I try to get brew's path I get no result:
# ssh [email protected] -p 2222 which brew
#
Troubleshooting:
brew is in /usr/...
2
votes
2
answers
1k
views
Cannot run command inside bash variable including square brackets with nullglob
Assuming I want to run commnand stored inside the variable with nullglob turned on. For example:
shopt -s nullglob
a="echo [foo]bar"
${a}
This gives me an empty output due to the nullglob option of ...
6
votes
6
answers
13k
views
How to pass an environment variable when change rooting?
I don't seem to be able to pass an environment variable to a chroot:
$ sudo apt-get install debootstrap dchroot
$ sudo debootstrap trusty mychroot
$ sudo chroot mychroot /bin/bash -c "MY_VAR=5; echo $...
0
votes
1
answer
1k
views
Remove a folder with the same name as an environment variable
I was messing around with a log4j properties file and accidently made a folder with the following text ${foo} however I also have an environment variable named foo that points to a folder so thus if I ...
2
votes
2
answers
732
views
Meaning of \ before environment variable
In ksh on an old Solaris box I used:
export PS1="$PWD $"
to set the prompt to the current directory. It works great until you cd elsewhere, then you see that it's not evaluating PWD each time. I ...
4
votes
6
answers
25k
views
How do I pass a variable from my local server to a remote server?
I am trying to pass a variable from my local server (location1) to a remote server (location2). The purpose of the code is to copy a file from the remote server from a predefined location. In simpler ...
25
votes
2
answers
12k
views
Expansion of a shell variable and effect of glob and split on it
This post actually contains two separate questions but I think grouping them together will give some more context. I have gone through this question on quotes around variables but I do not quite ...
2
votes
1
answer
5k
views
bash: export: `--wait': not a valid identifier
When I run git-sh from my terminal it works fine. But I get the following warning.
bash: export: `--wait': not a valid identifier
What is this and how do I get rid of it?
3
votes
1
answer
370
views
Why does this variable have no value even though it is set in .bashrc?
If I append this:
hi=11
export hi
to the .bashrc and then I su to this user with:
su - bela
then I:
echo $hi
11
Then it's working, the "hi" variable has the value of "11". But. When I:
su -...