Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5224998
  • 博文数量: 553
  • 博客积分: 13864
  • 博客等级: 上将
  • 技术积分: 11041
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-28 21:25
个人简介

个人Blog: hhktony.com

文章分类

全部博文(553)

文章存档

2015年(1)

2014年(2)

2013年(12)

2012年(384)

2011年(154)

分类: LINUX

2012-02-07 17:45:47

#!/bin/bash
#myvar='hello world!'
#echo $myvar

#echo -n "Enter your name:"
#read name
#echo "your name is $name"

#read -p "Enter your name:" name
#echo "your name is $name"

#myvar='foodforthougth.tar.gz';
#echo ${myvar#*fo}
#myvar=${myvar##*fo}
#echo ${myvar##*fo}
#echo ${myvar#*.}
#echo ${myvar##*.}

#myvar='foodforthougth.tar.gz';
#echo ${myvar%.*}
#echo ${myvar%%.*}

#cmd='ls'
#echo $cmd
#cmd=`ls`    #等价于cmd=$(ls)
#echo $cmd

#myvar=hello
#myvar="${myvar} world"
#echo $myvar

#filename="foo.tar.c"
#if [ ${filename##*.} = "gz" ]
#then
    #echo "${filename} is a tarball"
#elif [ ${filename##*.} = "c" ]
#then
    #echo "${filename} is a c source"
#else
    #echo "${filename} not a tarball or c source"
#fi

#if [ -e a.c ]
#then
    #echo a.c exist
#else
    #echo a.c not exist
#fi

#if [ -d a.c ]
#then
    #echo a.c is a diretory
#else
    #echo a.c not a diretory
#fi

string=hello
#if [ -z "$string" ]
#then
    #echo "len is zero"
#else
    #echo "len not zero"
#fi

#if [ $string != "hello" ]
#then
    #echo "not equal"
#else
    #echo "equal"
#fi

#myvar=03
#if [ $myvar -eq 3 ]
#then
    #echo "equal"
#fi
#if [ $myvar = "3" ]
#then
    #echo "equal"
#else
    #echo "not equal"
#fi

#for x in one two three four
#do
    #echo $x
#done

#for myfile in /etc/r*
#do
    #if [ -d $myfile ]
    #then  
        #echo "$myfile (dir)"
    #else
        #echo "$myfile"
    #fi
#done

#echo $0
#echo $1
#echo $#
#echo $@

#echo "your name $1"

#myvar=0
#while [ $myvar -ne 10 ]
#do
    #echo $myvar
    #myvar=$(($myvar + 1))
#done

#myvar=0
#until [ $myvar -eq 10 ]
#do
    #echo $myvar
    #myvar=$(($myvar + 1))
#done
 
 #myvar="hello"
 #myfunc() {
     #local x
     #local myvar="one two three"
     #for x in $myvar
     #do
         #echo $x
     #done
 #}
 #myfunc
 #echo $myvar $x


阅读(2003) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~