v.sh不使用终端ubuntu导出变量

时间:2014-08-11 05:29:53

标签: ubuntu terminal ubuntu-12.04

我想使用.sh脚本导出许多路径。运行后没有任何导出我不知道为什么。所以,如果有人可以提供建议。 这是使用的脚本:

#!/bin/bash

txtrst=$(tput sgr0) # Text reset
txtred=$(tput setaf 1) # Red
echo "${txtred}## var ##${txtrst}" 

T_D_L=/home/
T_D=$T_D_L

之后我运行echo $T_D_L但没有任何反应

1 个答案:

答案 0 :(得分:0)

我使用./script.sh来运行,正确的方法是source script.sh