在Linux下使用bash设置环境变量 [英] Setting environment variables in Linux using bash

查看:86
本文介绍了在Linux下使用bash设置环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的tcsh ,我有以下脚本工作:

In tcsh, I have the following script working:

#!/bin/tcsh
setenv X_ROOT /some/specified/path

setenv XDB    ${X_ROOT}/db
setenv PATH   ${X_ROOT}/bin:${PATH}

xrun -d xdb1 -i $1 > $2

我的问题是,什么是相当于的tcsh SETENV 功能庆典?有没有直接模拟?环境变量定位可执行文件。

My question is, what is the equivalent to the tcsh setenv function in bash? Is there a direct analog? The environment variables are for locating the executable.

推荐答案

出口VAR =值将设置为VAR值。将其用单引号,如果你想空间,如出口VAR ='我VAL。如果你想进行插值变量,使用双引号,像出口VAR =$ MY_OTHER_VAR

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".

这篇关于在Linux下使用bash设置环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆