读书人

shell总结(1)

发布时间: 2012-10-30 16:13:36 作者: rapoo

shell小结(1)

-------------------------------------------------------
samba服务器:

?

-------------------------------------------------------samba服务器://连接对方共享的共享,这个用户名是对方提供的,效果相当于ftp,如果对方机器开启了guest用户,则//不用输入用户名smbclient   //机器名/共享目录   -U   用户名//将window上的磁盘挂载到本机linux上的某一个目录下//这里的uid,gid是linux用户的uid,gid,必须指定,否则这里的y:会访问不了mount -t smbfs -o username=gkf14930,uid=9909,gid=100,iocharset=gbk //100.168.40.55/share /home/rbttest/dc0sp29_613/bin/y://启动samba服务/etc/init.d/smb restart//smb.conf配置[global]        workgroup = group245        security = share        netbios name = linu245        usershare allow guests = Yes  //指定以guest用户登录[rbt]         path = /home/rbttest/dc0sp29_613/bin/y:         writable = Yes         read only = no         guest   ok   =   yes         share   modes   =   yes-------------------------------------------------------linux默认的三个IO通道是:0:stdin1:stout2:sterr-------------------------------------------------------break与continue#!/bin/bashfor ((i=0;i<3;i++))doecho $ifor((j=0;j<3;j++))doif ((j==2))thenbreak 2 #这里的2代表跳出两层循环,即跳出整个循环fidonedone-------------------------------------------------------从文件中读取内容:#!/bin/bashwhile read linedoecho $linedone < text.txt当然也可以用{}将while语句包装起来-------------------------------------------------------read命令:#!/bin/bashread -p "input your name please: " nameif [ $name = "xuxu"] ;thenecho 'ok'fi如果用户直接回车时,则会报错,这时的常用的处理方式如下:“加一个额外的字符,从而保证比较的两个字符串都不为空”read -p "input your name please: " nameif [ X$name = X"xuxu"] ;thenecho 'ok'fi-------------------------------------------------------printf命令: printf 'name is %s\n' $name-------------------------------------------------------什么是shell脚本?命令与函数的集合-------------------------------------------------------登录环境:shell的初始化脚本与执行顺序/etc/profile~/.bash_profile~/.bash_login~/.bashrc~/.profile-------------------------------------------------------

?
#!/bin/bash

读书人网 >其他相关

热点推荐