Tag Info

New answers tagged

2

In console, TERM is typically set by login(1). It's actually system-dependent, see f.i. man 5 login.conf (on *BSD) or man 5 login.defs (on Linux). In a GUI TERM is set by the terminal emulator you're running, and your shell inherits it from the terminal emulator. For xterm(1), TERM is actually the XTerm.termName "resource", and it can be set either in a ...


-2

Bash's initialization can involve many different files. To find out precisely which of those files is setting your TERM variable, run the following: PS4='+ $BASH_SOURCE:$LINENO:' BASH_XTRACEFD=7 bash -xlic "" 7>trace.out grep TERM trace.out The first line starts up bash verbosely saving information on every start-up command to the file trace.out. ...


0

Yes: $ export TEST=`script.py` $ echo $TEST 5 You need to tell the shell to set test to the result of running script.py, which is what the backticks do for you. There are alternate shell constructs that will do the same thing, like $(script.py), but I almost always use backticks.


0

You can use alias for that. From man sh: Aliases An alias is a name and corresponding value set using the alias(1) builtin command. Whenever a reserved word may occur (see above), and after checking for reserved words, the shell checks the word to see if it matches an alias. If it does, it replaces it in the input stream with its ...


18

zsh like most modern shells have a choice between two different keyboard mappings for command-line editing: a vi one and an emacs one. In some shells (like tcsh or readline-based ones like bash), the emacs one is the default and probably the one you expect. With zsh, you get emacs mode by default unless $EDITOR or $VISUAL contains vi (if you're a ...


2

Looks like your dollar sign in the 12th variable is in the wrong place. export TYPE_RELN_IDS="{$12}" should be export TYPE_RELN_IDS="${12}"


0

Inspired by @Peter Cordes and @Michael Durrant's answers, I came up with a limited and lightweight solution for my special case. Firstly let me re-illustrate my real issues. I need to use different llvm related executables (clang, llvm-config, etc) that are under project local directories, and I need to use 1 default version for general purpose ...


2

Yuch, too much maintenance and too much individual stuff. I'd recommend putting most of the effort into having appropriately scoped names that are appropriate for the platform so you can just have all of them all of the time. PYTHONPATH is a good example... you're unlikely to want to repurpose it for a Ruby project... You can group and mark the group with ...


1

Use export for environment variables. Environment variables are an operating system feature. Environment variables are inherited by child processes: if you set them in a shell, they're available in all the programs started by this shell. Variables used by many applications or by specific applications other than shells are environment variables. Here are a ...


0

You can source any file you like, it doesn't have to be .zshrc. You could make an env-setup script for each different project, and keep it in the project directory. If you want to be able to start new shells and have them load the env settings, you have a couple options: Always start your shells in the project directory, and have your .zshrc [[ -e ...


-1

just write the variable or data needed to a local file and then in the script run an scp command to send the file to the remote server. on the remote server, have a script that will check periodically (via cron) for the file and read it's contents and do whatever you want it to do.


4

By strict interpretation what you want to do is impossible. So the question is how much do you have to cheat to pull something like this off? You need bash, a PROMPT_COMMAND and two temporary files. you will also have to accept that the shell will not be updated until the command after completion of the background task. I would also recommend using make in ...


1

Old question, but the cleanest solution for vim in zsh was to add the alias to ~/.zshenv, the file that zsh loads for all shells, login, interactive, or otherwise. This avoids starting vim or zsh with flags and any possible problems with that. There's a nice explanation of ~/.zshenv vs ~/.zshrc here: http://tanguy.ortolo.eu/blog/article25/shrc Basically, ...


2

You need double quote in command substitution, otherwise, the shell will perform field splitting with the result of command substitution: $ env "$(echo 'VALUE="this is a test"')" ./somescript.sh "this is a test" For env reading from file, you must let the shell does field spliting, but set IFS to newline only, so your command won't break with space: $ ...


1

It is an interesting exercise to write a bash function to remove a directory from a path variable. Here are some functions I use in my .bash* files to append/prepend directories to paths. They have the virtue of removing duplicate entries, if any, and work with any kind of colon separated path variable (PATH, MANPATH, INFOPATH, ...). the remove_from ...


0

Strictly speaking, environment variables aren't "saved" as we tend to think of saving. They exist in the memory of a process. They're created when a process starts (possibly as a copy of the environment variables from the calling process) In Linux, you actually can get them as a "file" of sorts, if you know the PID of the process you want the environment ...


5

Environment variables are stored in memory associated with a process. Every process has access to its own set of environment variables. A child process (one started by the "current" process) inherits a copy of those variables. It's not possible for any process to alter any other process's environment variables. Using a shell such as bash you can define ...


1

Yes and no (more yes than no, though). They are in your shell's memory, so not only do they go away when your current shell exits, they will not be there if you open a new shell anywhere other than your current shell.


7

DISPLAY=:0 gnome-panel is a shell command that runs the external command gnome-panel with the environment variable DISPLAY set to :0. The shell syntax VARIABLE=VALUE COMMAND sets the environment variable VARIABLE for the duration of the specified command only. It is roughly equivalent to (export VARIABLE=VALUE; exec COMMAND). The environment variable ...


18

It's an environment variable that is passed just to that program, rather than the shell as a whole. This happens when you set a variable on the same line as a command. X11 programs need to know where to display windows, since it's a client/server system and you could be displaying on a remote machine. This simply means use the first display on the local ...


2

The default PATH is set in /etc/profile. Users can modify their PATH by editing ~/.profile, ~/.bash_profile or ~/.bashrc (if they're running bash) but if they don't they will still have a PATH as defined in /etc/profile. That's why the line was PATH=$PATH:$HOME/bin and not just PATH=$HOME/bin That way, the original value of PATH is kept and the new ...



Top 50 recent answers are included