leeboy的linux学习十三环境变量实例
来源:互联网 发布:大数据未来前景 编辑:程序博客网 时间:2024/06/13 10:38
环境变量和本地变量的区别在于是不是具有继承性,下面介绍一个环境变量的例子:
exportFather父进程:
#!/bin/sh#father scriptecho "this is the father"FILE="A GOOD MAN"echo "I like the file : $FILE"export FILE #声明为环境变量,如果此处不声明,exportChild无法使用该变量./exportChild #执行子进程echo "back to father"echo "and the file is : $FILE"
exportChild 子进程:
#!/bin/sh#child fileecho "this is Child"echo "I like my father's file : $FILE"FILE="Child File" #子进程中修改该环境变量对主进程中没有影响echo "my file is : $FILE"
执行结果如下:
[root@localhost textFile]# ./exportFather this is the fatherI like the file : A GOOD MANthis is ChildI like my father's file : A GOOD MANmy file is : Child Fileback to fatherand the file is : A GOOD MAN//环境变量在子进程中修改但父进程中没有变化
如果我想在子进程中修改的环境变量也能影响到主进程的改环境变量,该如何做呢?望大牛指导!
- leeboy的linux学习十三环境变量实例
- leeboy的linux学习六grep实例
- leeboy的linux学习七awk实例
- leeboy的linux学习九sed实例
- leeboy的linux学习十sort实例
- leeboy的linux学习十一tr实例
- leeboy的linux学习十二环境及环境变量
- leeboy的linux学习十四 引号实例详解
- leeboy的linux学习二
- leeboy的linux学习三
- leeboy的linux学习四
- leeboy的linux学习五
- leeboy的linux学习笔记一
- leeboy的linux学习八awk脚本
- leeboy的linux学习十五 shell中条件测试和简单的条件语句实例
- linux环境变量的学习
- 输出linux系统的所有环境变量实例
- linux学习之十三---多线程的创建
- 职场感悟—刚入行,想晋升吗?
- js获得网页中某元素的坐标位置
- 路上看水
- 黑马程序员_JavaSE基础12 之 导入包 多线程的创建
- ZOJ1074
- leeboy的linux学习十三环境变量实例
- QWidget与HWND的互相转换
- 腾讯开放平台开发之感
- AdaBoost中利用Haar特征进行人脸识别算法分析与总结2——级联分类器与检测过程
- 在mac下添加环境变量
- unrecognized selector sent to instance
- LaTeX之公式及编号
- STM32F系列JTAG口重映射成为普通GPIO
- Android Camera 架构