if [ $fn1 = $fn2 ]; then
echo "nothing to do!"
exit
fi
if [ ! -f $fn1 ]; then
echo "file [" $fn1 "] not exist !"
exit
fi
if [ -f $fn2 ]; then
echo "file [" $fn2 "] exist"
read -p "overwrite (Y/n)? " confirm
if [ "$confirm" == "n" -o "$confirm" == "N" ]; then
echo "skip cpoy!"
exit
fi
fi
cp -f $fn1 $fn2
echo "copy done!"
[watchme 在 2013-5-3 10:11 AM 作了最後編輯]發表人:
watchme 時間: 2013-5-3 11:02 AM
namelist=""
oldIFS=$IFS
IFS=$'\n'
for name in $(cat names)
do
if [ "" = "$namelist" ]; then
namelist=$name
else
namelist=$namelist:$name
fi
done
IFS=$oldIFS
echo $namelist發表人:
watchme 時間: 2013-5-3 02:14 PM
7.
#!/bin/sh
if [ $# = 1 ]; then
who | grep "^$1"
else
echo "syntax error"
fi發表人:
watchme 時間: 2013-5-3 02:30 PM
case $space in
1)
# Add Account
echo "Add Account"
echo ""
read -p "Enter user name : " username
# handle single or multiple user
for user in ${username}
do
_Add ${user}
done
;;
2)
# Delete Account
echo "Delete Account"
echo ""
read -p "Enter user name : " username
# handle single or multiple user
for user in ${username}
do
_Del ${user}
done
;;
3)
# Query Account
echo "== Query Account =="
echo ""
read -p "Enter user name : " username