#!/bin/bash
count=0
while [ true ]
do
count=$(( $count+1 ))
echo $count
if [ $count -eq 10 ];then
break
fi
sleep 1
done
目前分類:Shell programming (12)
- Apr 22 Tue 2014 10:11
shell - while loop
- Apr 22 Tue 2014 10:09
expect - sftp example
#!/opt/csw/bin/expect
set timeout 20
spawn sftp root@host
expect "*password*"
send "ej03xu35k3au4a83\r"
expect "*sftp*"
send "cd /usr/bin/\r"
expect "*sftp*"
send "put rsync\r"
expect "*sftp*"
send "exit\r"
interact
- Feb 27 Mon 2012 12:15
Shell - Arithmetic operation
In Shell programming , we should use $(( )) if we want to do arithmetic operation.
for example :
- Feb 27 Mon 2012 11:06
Shell - String concatenation
Sometimes , we may want to concantenate two string into one string.
It is simple in Shell programming , the example is as below:
- Jan 21 Sat 2012 21:09
Shell - Extract substring
- Jan 21 Sat 2012 21:05
Shell - Read file line by line
- Dec 29 Thu 2011 00:46
Shell - if then .. else..fi
- Dec 29 Thu 2011 00:42
Shell - grep , 尋找file中的關鍵字
- Dec 28 Wed 2011 23:49
Shell - echo two variables
- Dec 28 Wed 2011 23:27
Shell - for loop from 1 to 100
- Dec 28 Wed 2011 23:25
shell - for loop
- Dec 28 Wed 2011 23:15
Shell - 變數 (Variable)