linux shell script Àý×Ó1
1. ÈçºÎ»ñµÃ½Å±¾²ÎÊý£º
#!/bin/she
#
while [ -n "$1" ]
do
case "$1" in
-a) echo "found the -a option";;
-b) param="$2"
echo "found the -b option";;
-c) echo "found the -c option";;
--) shift
break;;
*) echo "$1 is not an option";;
esac
shift
done
count=1
for para in "#@"
do
echo "parameter #$count : $para"
count=$[ $count + 1 ]
done
2.ÅжÏÊäÈëÊÇ·ñ·ûºÏÌõ¼þ£º
#!/bin/sh
#
read input
if [[ $input == r* && ${#input} -eq 10 ]]; then #check the input character bits
echo "yes, your input right."
else
echo "no ,your input error."
fi
3.ÈçºÎÈÃÓû§ÊäÈ룬Èç¹ûÄãÏëµÃµ½Óû§ÊäÈëÒ»¶¨Òª¼ÇµÃread command.
#!/bin/sh
#
#
read -n1 -t 10 -p "Do you want to continue [Y/N]?" answer
case $answer in
Y | y) echo
echo "fine, continue on ... ";;
N | n) echo
echo "ok, goodbye
exit;;
esac
echo "this is the end of the script"
4.´ÓÎļþÖжÁ³öÊý¾Ý
#!/bin/sh
#
#
#
count=1
cat testfile | while read line
do
echo "Line $count : $line"
count=$[ $count + 1 ]
done
echo "finished processing the file"
#you can also use the read command to read data stored in a file on the linux system. each call to the read command reads a single line of text from the file. when there are no more lines left in the file,the read command will exit with a non-zero exit status.
5.´´½¨×Ô¼ºµÄÖض¨ÏòÎļþÃèÊö·û
#!/bin/bash
# storing STDOUT, then coming back to it
exec 3>&1
exec 1>test14out
echo "This should store in the output file"
echo "along with this line."
exec 1>&3
echo "Now things should be back to normal"
#This example is a little crazy, so let’s walk through it piece by piece. First, the script redirects file descriptor 3 to the current location of file descriptor 1, which is STDOUT. This means that any output sent to file descriptor 3 will go to the monitor.The second exec command redirects STDOUT to a file. The shell will now redirect any output se
Ïà¹ØÎĵµ£º
½ñÌìÔÚÔËÐÐsphinxµÄʱºò£¬Ìáʾ˵
./searchd: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory
ÎÒ±àÒë°²×°µÄʱºòÃ÷Ã÷ÓÐÖ¸¶¨mysqlµÄlib¿â°¡£¬ÉÏÍø²éµ½ÊÇÒòΪmysqlµÄlib²»ÔÚϵͳµÄlib·¾¶ÖУ¬½â¾ö°ì·¨ÈçÏ£º
ÔÚ/etc/ld.so.confÏÂÃæ¼ÓÒ»ÐÐ/usr/loc ......
Technorati ±êÇ©: linux,at Ãû³Æ : at
ʹÓÃȨÏÞ : ËùÓÐʹÓÃÕß
ʹÓ÷½Ê½ : at -V [-q queue] [-f file] [-mldbv] TIME
˵Ã÷ : at ¿ÉÒÔÈÃʹÓÃÕßÖ¸¶¨ÔÚ TIME Õâ¸öÌض¨Ê±¿ÌÖ´ÐÐij¸ö³Ìʽ»òÖ¸ÁTIME µÄ¸ñʽÊÇ HH:MMÆäÖÐµÄ HH ΪСʱ£¬MM Ϊ·ÖÖÓ£¬ÉõÖÁÄãÒ²¿ÉÒÔÖ¸¶¨ am, pm, midnight, noon, teatime(¾ÍÊÇÏÂÎç 4 µãïñ ......
sourceÃüÁ
sourceÃüÁîÒ²³ÆΪ“µãÃüÁ¬Ò²¾ÍÊÇÒ»¸öµã·ûºÅ£¨.£©¡£sourceÃüÁîͨ³£ÓÃÓÚÖØÐÂÖ´ÐиÕÐ޸ĵijõʼ»¯Îļþ£¬Ê¹Ö®Á¢¼´ÉúЧ£¬¶ø²»±Ø×¢Ïú²¢ÖØеǼ¡£
Ó÷¨£º
#vim ~/.bashrc
#source ~/.bashrc
......
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
¹È¸èºÜÅ£Æø£¬¸ù±¾²»Àí»á
Linux
Äں˿ª·¢ÍŶӣ¬½á¹û±»³ýÃû¡£¿É±¯Ò²£¡
2
ÔÂ
3
ÈÕ£¬
Linux
Äں˿ª·¢Õß
Greg
Kroah-Hartman
½«
Android
µÄÇý¶¯³ÌÐò´ ......