#!/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) |