export VAR=value
will set VAR to value. Enclose it in single quotes if you want spaces, like export VAR='my val'
. If you want the variable to be interpolated, use double quotes, like export VAR="$MY_OTHER_VAR"
.
More Related Contents:
- When should I wrap quotes around a shell variable?
- What’s the magic of “-” (a dash) in command-line parameters?
- Aborting a shell script if any command returns a non-zero value
- What does $@ mean in a shell script?
- Better way to rename files based on multiple patterns
- Forcing bash to expand variables in a string loaded from a file
- Linux: copy and create destination dir if it does not exist
- What is the difference between using `sh` and `source`?
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- Does “argument list too long” restriction apply to shell builtins?
- Given two directory trees, how can I find out which files differ by content? [closed]
- How to sort a file in-place?
- How to run a shell script on a Unix console or Mac terminal?
- Using the passwd command from within a shell script
- Is it OK to use the same input file as output of a piped command?
- When to wrap quotes around a shell variable?
- How do you normalize a file path in Bash?
- Linux/Unix command to determine if process is running?
- Running shell script in parallel
- Difference between shell and environment variables
- What’s the point of eval/bash -c as opposed to just evaluating a variable?
- Need to remove the count from the output when using “uniq -c” command
- How do you run a script on login in *nix?
- Why should eval be avoided in Bash, and what should I use instead?
- How to kill a child process after a given timeout in Bash?
- ./configure : /bin/sh^M : bad interpreter [duplicate]
- The ‘eval’ command in Bash and its typical uses
- How to join multiple lines of file names into one with custom delimiter?
- How to get file creation date/time in Bash/Debian?
- Creating temporary files in bash