一些杂项,随笔

来源:互联网 发布:免费中文字体下载mac 编辑:程序博客网 时间:2024/05/21 22:21
echo ${file%.*}

!-e      若文件存在
 2>&1  错误信息重定向到标准输出,&表示分割
Mysqladmin  -uroot  -passwordab12
find /data/ -type f -name "mysql" |xargs ls -al
$PATH路径修改,要放到最前面
ls -alfR $flie |grep -v"\/" |grep -v ^"\." |grep "\." |awk -F. '{printf "\n" $NF}' >/tmp.tmp


启动
mysql -S/data/3306/mysql.sock

改密码
mysqladmin -uroot -S /data/3306/mysql.sock password '123.com'

   条件表达式
文件表达式
if [ -f  file ]   如果文件存在
if [ -d ...   ]   如果目录存在
if [ -s file  ]   如果文件存在且非空 
if [ -r file  ]   如果文件存在且可读
if [ -w file  ]   如果文件存在且可写
if [ -x file  ]   如果文件存在且可执行  
整数变量表达式
if [ int1 -eq int2 ]   如果int1等于int2  
if [ int1 -ne int2 ]   如果不等于    
if [ int1 -ge int2 ]      如果>=
if [ int1 -gt int2 ]      如果>
if [ int1 -le int2 ]      如果<=
if [ int1 -lt int2 ]      如果<</div>
   
   字符串变量表达式
If  [ $a = $b ]              如果string1等于string2
                           字符串允许使用赋值号做等号
if  [ $string1 !=  $string2]   如果string1不等于string2      
if  [ -n $string            如果string非空(非0),返回0(true)  
if  [ -z $string            如果string为空
if  [ $sting ]               如果string 非空,返回0 (和-n类似)   
原创粉丝点击