易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

Linux下GetModuleFileName的四种写法

Linux下GetModuleFileName的四种写法
  问题的起因是要把一个东东从Windows移植到基于Linux的嵌入式系统上。移植过程中,遇到了GetModuleFileName的问
题。为了解决这个问题,花了不少的时间,也走了不少弯路。下面是整理的结果。
  首先摘录一段文字,来源《UNIX Programming FAQ 中文版》
 
1.14. 我怎样找 ......

在LINUX环境下用nat方式上网与五笔安装

在win主机上用ipconfig查看VMnet8的IP地址,
一般是192.168.X.1/255.255.255.0,
此时VMnet8的设置应该是自动获取IP,现在改成静态IP,并把此IP直接填入VMnet8里,不设网关。 
同时在VM网络设置里的NAT项中查看VMnet8,一般是192.168.X.2/255.255.255.0
这个地址就是VMnet8,NAT的网关 
现在在LINUX下把网卡I ......

关于LINUX中的FORK函数

一直想写点LINUX中的FORK函数,但是吧,我实在是太懒了,再加上文采不怎么好,所以就从网上找了篇写的不错的文章,看完之后应该对FORK函数有一定的了解~~
 
给出如下C程序,在linux下使用gcc编译:
1 #include "stdio.h"
2 #include "sys/types.h"
3 #include "unistd.h"

5  int  main()
6 ......

Linux操作系统内核启动参数详细解析

Linux内核在启动的时候,能接收某些命令行选项或启动时参数。当内核不能识别某些硬件进而不能设置硬件参数或者为了避免内核更改某些参数的值,可以通过这种方式手动将这些参数传递给内核。
如果不使用启动管理器,比如直接从BIOS或者把内核文件用“cp zImage /dev/fd0”等方法直接从设备启动,就不能给内核传递 ......

linux redhat 5.0 网页中文字体乱码

1. linux 图形化界面乱码,一般是因为没有安装中文字体导致,可以在终端查询已经安装的字体  rpm -qa | grep fonts
    如果没有font-chinese,可以下载或从安装盘中找到 fonts-chinese-3.02-12.el5.noarch.rpm 安装即可。
2. 远程连接中文乱码:
vi /etc/sysconfig/i18n
将内容改为
LANG="zh_CN. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号