快速业务通道

rche 033----unit9

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-05-02
unit9 config the bash shell
.local variables
.aliases and functions
.the set command
.environment variables
variables: A variable is a label that has a value
.used to config the shell or other programs
.variables are resided in memory
.two types :local and environment
.local varibales are used only by the shell
.environment variables are passed onto other commamd

.display variables and values using
.set to display all variables
.env to display environment variables

set |more 查看系统中所有的变量

env | more ===环境 变量

configuring the shell: local variables

.Data in shell scripts and environment settings stored in variables
.conventionally all upper-case
.setting variable value
$ FAV_COLOR=blue
set |more 查看
.to retrieve variable value.use $ before variable name

echo $FAV_COLOR
blue


4,common local variables

.histfilesize determines how many commands to be saved
in the history file on logout
.columns sets the width of the terminal
.lines sets the height of the terminal


5,ps1 local variable
. ps1 sets the prompt
.d today is date
.h short hostname
.t current time
.u user name
.w current working directory
.! the history number of current command
.$ shows $ if you are a none-privileged user and a # if you are a privileged user
.l the basename of the shell is terminal device name

[root@mycentos ~]# echo $PS1
[u@h W]$
[root@mycentos ~]#

PS1=''[u@h w l d t !]

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号

'
[root@mycentos ~ 0 Tue Apr 28 03:47:37 342]#

PS1=''[u@h w ttyl d t !]

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

1234下一页
分享到: 更多
你可能对下面的文章感兴趣
上一篇: Linux下如何使用虚拟用户增加FTP的安全性下一篇: linux shell 编写屏幕产生颜色的脚本学习笔记
关于rche 033----unit9的所有评论

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号

'
[root@mycentos ~ tty0 Tue Apr 28 03:48:19 343]# 6,Aliases
.Aliases let you create shortcuts to commands
$ alias if=''ls -laF''
.USE alias by itself to see all set aliases
.use alias followde by an alias name to see alias value $alias if
alias if=''ls -laF''
alias 显示系统中的别名
alias if

.set -o noclobber
.set -o vi
[root@mycentos ~]#ls -l doc1
total 28
-rw-r--r-- 1 root root 1 Apr 28 03:54 test1.txt
-rw-r--r-- 1 root root 60 Apr 27 23:16 test2.txt
-rw-r--r-- 1 root root 42 Apr 27 23:16 test3.txt
-rw-r--r-- 1 root root 0 Apr 27 23:14 text1.txt
[root@mycentos ~]#cal > doc1/test1.txt
[root@mycentos ~]#cat doc1/test1.txt
April 2009
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 [root@mycentos ~]#ca >& doc1/text1.txt 正确和错误的信息传入到text1.txt
[root@mycentos ~]#cat doc1/text1.txt
-bash: ca: command not found
[root@mycentos ~]#set -o noclobber=====保留原来的内容
[root@mycentos ~]#cal > doc1/text1.txt
-bash: doc1/text1.txt: cannot overwrite existing file
[root@mycentos ~]#cal >> doc1/text1.txt
[root@mycentos ~]#cat doc1/text1.txt
-bash: ca

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

1234下一页
分享到: 更多
你可能对下面的文章感兴趣
上一篇: Linux下如何使用虚拟用户增加FTP的安全性下一篇: linux shell 编写屏幕产生颜色的脚本学习笔记
关于rche 033----unit9的所有评论

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号