Linux Shell 笔记二(循环结构)
程序12:类似java 里面的switch case
[root@localhost scripts]# cat sh12.sh
read -p "input comand:" command
case $command in
"fix")
echo "fix system"
;;
"fuck")
echo "fuck you"
;;
*)
echo "what a stupid man!ex>$0 some word"
esac
exit 0
程序13:简单简单,超级简单的一个函数
[root@localhost scripts]# cat sh13.sh
function printit()
{
echo -n "Your choice is $1"
}
#$1为控制台输入的第二个参数
printit 1;echo $1 | tr 'a-z' 'A-Z'
程序14:until do done
[root@localhost scripts]# cat sh14.sh
until [ "$yn" = "yes" ] || [ "$yn" == "YES" ]
do
read -p "please input yes/to stop this program:" yn
done
程序15:while do done
[root@localhost scripts]# cat sh15.sh
s=0
i=0
while [ "$i" != "100" ]
do
i=$(($i+1))
s=$(($s+$i))
done
echo "number of 1+2+3+...+100=$s"
程序16:for do done
[root@localhost scripts]# cat sh16.sh
s=0
for((i=1;i<=100;i=i+1))
do
s=$(($s+$i))
done
echo $s
exit 0
程序17:for do done(2)
[root@localhost scripts]# cat sh17.sh
for animal in dog cat elephant
do
echo "there are ""$animal"
done
exit 0
程序18:利用 for do done查找某一个目录下面的文件权限信息
[root@localhost scripts]# cat sh18.sh
read -p "input a directory:" dir
if [ "$dir" == "" ] || [ ! -d "$dir" ]; then
echo "The $dir is not exist in the system"
exit 1
fi
echo `ls $dir`
filelist=`ls $dir`
for filename in $filelist
do
perm="";
test -r "$dir/$filename" && perm="$perm readable"
test -w "$dir/$filename" && perm="$perm writable"
test -x "$dir/$filename" && perm="$perm execuatable"
echo "The file $dir/$filename's permission is $perm"
done
相关文档:
http://plugindoc.mozdev.org/linux-amd64.html#flash
download flash:
http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz
cp libflashplayer.so /usr/lib/mozilla-firefox/plugins
restart firefox
check:
about:plugins ......
# uname -a # 查看内核/操作系统/CPU信息
# head -n 1 /etc/issue # 查看操作系统版本
# cat /proc/cpuinfo # 查看CPU信息
# hostname&nb ......
一.填空题
1. 在Linux系统中,以 方式访问设备 。
2. Linux内核引导时,从文件 中读取要加载的文件系统。
3. Linux文件系统中每个文件用 来标识。
4. 全部磁盘块由四个部分组成,分别为 。
5. 链接 ......
一直想写点LINUX中的FORK函数,但是吧,我实在是太懒了,再加上文采不怎么好,所以就从网上找了篇写的不错的文章,看完之后应该对FORK函数有一定的了解~~
给出如下C程序,在linux下使用gcc编译:
1 #include "stdio.h"
2 #include "sys/types.h"
3 #include "unistd.h"
4
5 int main()
6 ......
简介
Basic 是使用的最广泛的、最简单的编程语言之一,尤其是对于新手。 迄今为止,最常用的 Basic 开发环境是 Microsoft 的 Visual Basic 集成开发环境。 近来,Linux 的使用范围已经延伸到了桌面环境。从最初的仅限于服务器应用,使得人都是领导者,它正在变成一个客户端计算机的操作系统,满足了类似阅读电子邮件、上网 ......