Linux Shell中判断某个环境变量是否存在以及获取某个环境变量的值
2012-02-08 17:14
295 查看
Shell中判断某个环境变量是否存在以及获取某个环境变量的值
#!/bin/bash
if [ $TOMCAT_HOME ];
then
echo "not found "
else
tar xvf /home/a.tar
fi
echo $TMPPATH #直接用'#'+环境变量名在shell中使用环境变量的值
if [ -z $TMPPATH ] ; then
echo "no tmppath "
else
...
fi
-z 是检查字符串是否为空
检查文件为空用 -s来判断
-a file True if file exists.
-d file True if file exists and is a directory.
-f file True if file exists and is a regular file.
-n string True if the length of string is non-zero.
string1 == string2 True if the strings are equal.
string1 != string2 True if the strings are not equal.
string1 < string2 True if string1 sorts before string2 lexicographi
简单明了的shell bash脚本文件生成介绍: http://blog.sina.com.cn/s/blog_633fdd420100pnt4.html
#!/bin/bash
if [ $TOMCAT_HOME ];
then
echo "not found "
else
tar xvf /home/a.tar
fi
echo $TMPPATH #直接用'#'+环境变量名在shell中使用环境变量的值
if [ -z $TMPPATH ] ; then
echo "no tmppath "
else
...
fi
-z 是检查字符串是否为空
检查文件为空用 -s来判断
-a file True if file exists.
-d file True if file exists and is a directory.
-f file True if file exists and is a regular file.
-n string True if the length of string is non-zero.
string1 == string2 True if the strings are equal.
string1 != string2 True if the strings are not equal.
string1 < string2 True if string1 sorts before string2 lexicographi
简单明了的shell bash脚本文件生成介绍: http://blog.sina.com.cn/s/blog_633fdd420100pnt4.html
相关文章推荐
- Linux Shell 判断环境变量 是否存在
- 判断Linux Shell环境变量是否存在
- android 获取路径目录方法以及判断目录是否存在,创建目录 (转)
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- 判断环境变量是否存在
- Linux shell脚本中判断变量文件目录:权限、是否存在、空值、相等
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- android 获取路径目录方法以及判断目录是否存在,创建目录
- svn判断通过svnkit,获取最新的revision以及判断某个revsion是否存在
- java 获取elasticsearch Client以及 判断是否存在此索引
- android 获取路径目录方法以及判断目录是否存在,创建目录
- 通过svnkit,获取最新的revision以及判断某个revsion是否存在
- svn判断通过svnkit,获取最新的revision以及判断某个revsion是否存在