Tagged Questions
The environment-variables tag has no wiki summary.
3
votes
3answers
76 views
Last failed command in bash
The $? variable holds the exit status of last run command. Is there a variable that holds last run command itself?
1
vote
3answers
56 views
How do I set a user environment variable? (permanently, not session)
This is irritating me. I seen several suggestions (all using different files and syntax) and none of them worked.
How do I set an environment variable for a specific user? I am on debian squeeze.
...
4
votes
5answers
109 views
PATH environment variable in linux
I want to know how the standard environment variables given by the linux OS like PATH, HOME are set automatically. In which file are these read from. There should be some file from which these ...
3
votes
2answers
78 views
How to run a cronjob in my regular environment?
Both the shell and environment variables that cronjobs are run in is completely different from the ones presented to me in gnome-terminal. How can I run a cronjob under the same circumstances as if I ...
4
votes
3answers
71 views
How can I make a public variable in Linux that all users would see?
I need to have a variable $FOO on the system that contains a string all users could use, but I have no idea how to create one.
The Upstart job is obviously not a solution as from this thread - Is it ...
1
vote
1answer
53 views
Is it possible to export env variable via Upstart?
I need to export a variable FOO=stringhere so that system processes could use it. And the place I would like to do this, is Upstart job.
Unfortunately, I tried as per Upstart manual to do env ...
4
votes
3answers
148 views
Need help deciphering unix statement
I need help deciphering what is being said here:
export IP=`/sbin/ifconfig | grep 'inet addr:'|grep -v '127.0.0.1'|
cut -d: -f2 | awk '{print $1}'`
I know it is to set IP as an environment ...
3
votes
2answers
41 views
Question on setting variables in loop conditions
I have a while loop that allows setting variables when written one way but does not allow it when written another way. Why is that? This prints var as 1234 and does not print var2
#!/bin/bash
...
3
votes
2answers
100 views
In `while IFS= read..`, why does IFS have no effect?
I might have something absolutely wrong, but it looks convincing to me, that setting IFS as one of the commands in the pre-do/done list has absolutely no effect.
The outer IFS (outside the while ...
3
votes
3answers
270 views
Why is `while IFS= read` used so often, instead of `IFS=; while read..`?
It seems that normal practice would put the setting of IFS outside the while loop in order to not repeat setting it for each iteration... Is this just a habitual "monkey see, monkey do" style, as it ...
1
vote
1answer
65 views
How do you set an environment variable?
Please explain how to set environment variables. I need to point an environment variable to a xml file.
2
votes
2answers
31 views
Tell pkg-config to look *.pc files also in /usr/local/lib/pkgconfig, system-wide
Right now pkg-config looks only in /usr/lib/pkgconfig. I can adjust it for a user by exporting the PKG_CONFIG_PATH environment variable, but once again I forgot to do it for root and wasted time ...
4
votes
1answer
83 views
Where have I set my bash PATH?
I want to remove ~/bin from my PATH. I set it up months ago when Linux (Ubuntu) was very new to me, but I don't know how I added it...
Nothing shows up when I search all the files listed below.
...
3
votes
3answers
58 views
Easy way to restore your MANPATH
I was attempting to add the man pages for my texlive distribution today when I accidentally did this:
$ MANPATH=MANPATH:/usr/local/texlive/2011/texmf/doc/man
$ export MANPATH
...when I meant this:
...
2
votes
2answers
82 views
Exception of inheritance of environment variables
Quoted from Wikipedia:
By default, when a process is created it inherits a duplicate
environment of its parent process, except for explicit changes made by
the parent when it creates the ...