shell变量中再包含变量的情况!
来源:互联网 发布:安卓转发小视频源码 编辑:程序博客网 时间:2024/06/05 08:05
#!/bin/bashERR_0="The $1 is exist!"ERR_1="The $1 is not exist!"function test(){ if [ -e $1 ] ; then return 0 else return 1 fi}test $1ret=$?eval result=\$ERR_$retecho $result
执行结果为:
CS> ./test.sh /root/test.sh
The /root/test.sh is not exist!
CS> ./test.sh /root/qx/test.sh
The /root/qx/test.sh is exist!
CS> ./test.sh /root/test.sh
The /root/test.sh is not exist!
CS> ./test.sh /root/qx/test.sh
The /root/qx/test.sh is exist!
0 0
- shell变量中再包含变量的情况!
- SHELL中特殊的变量
- shell 中变量的定义
- shell变量中 && ||的用法
- shell 中变量的定义
- shell 中变量的介绍
- shell 中变量的截取
- shell中变量的使用
- shell中变量的定义
- Linux shell脚本中执行命令结果赋值给变量&&echo输出变量是否包含换行符的问题
- 【脚本】shell 判断变量中是否包含某个字符串
- shell 判断变量中是否包含某个字符串
- ksh中包含变量的命令调用
- sed 中带变量的情况
- shell的扩展(解释了shell单引号,双引号,变量中包含空行,echo时换行符变成空格等)
- Shell 变量的变量用法
- shell变量的组合变量
- Shell中脚本变量和函数变量的作用域
- IntelliJ IDEA 使用总结
- 【浅谈JavaEE框架】Spring常用注解,自动扫描装配Bean
- 使用位运算转换大小写
- redis字符串类型操作
- iOS button边框
- shell变量中再包含变量的情况!
- 所谓经验,多半扯淡
- uninx常用命令
- stm32f103 timer1产生400HzPWM
- 大话设计模式——学习方法、总结方法体悟
- JIRA安装破解
- 客户端跳转与服务器端跳转
- CV机枪手opencv3(一)——模块结构解析
- Java基础——集合