Liby's Blog

 汝鬼耶,抑人耶?

Archive for the ‘shell’ tag

留个记号

without comments

1
2
3
4
5
6
7
8
9
10
#!/bin/bash
a=$1
b=$2
echo "$a,$b"
if [ $a -gt $b ]
then
echo "$a>$b"
else
echo "$b>$a"
fi
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
folder=$PWD
echo "$folder"
count=0
for files in *
do
if
[ -f "$files" ]
then
count=`expr $count + 1`
fi
done
echo $count
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash
echo -n "input number:"
read num
nbak=$num
i=0
reverse=""
while [ $nbak -ne 0 ]
do
i=$[ $nbak % 10]
nbak=$[ $nbak / 10]
reverse="$reverse$i"
done
echo "$reverse"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
if [ $1 = "" ] || [ $2 =  ""]
then
echo "enter parameter"
exit 1
fi
source=$PWD/$1
desert=$2
echo "$source move to $desert"
if [ -e $desert$1 ]
then
until [ !-e $desert$1 ]
do
echo "files has been deleted"
done
else
mv $PWD/$1 $desert/$1
fi

Written by liby

4月 11th, 2012 at 3:10 下午

Posted in 技事巧事

Tagged with ,