加几个网址

http://www.icycandy.com/blog/filter-illegal-characters-in-xml

 

外加一个小技巧

 

昨天在CU上见到一个网友提问如合用一个命令一下子解压多个ZIP文件,当时告诉他用分号隔开,然后执行多个命令,他却说这个过于繁琐,汗.......

不过仔细想想,却暗中佩服这位网友的这种思维方式,人类的财富不都是那些所谓的懒人提出来的想法,然后有人去实现的吗?不管如何,有想法就好,最可怕的是提不出问题,脑子一片空白,呵呵...........

其实这种问题的解决方法有很多种,这里列举四种比较常见的:

法一:用分号隔开(适用于对象较少的时候)

# ls
p2848731_11i_SOLARIS.zip  p2848731_11i_zhs.zip      p4262360_11i_GENERIC.zip
#unzip p2848731_11i_SOLARIS.zip  ;unzip p2848731_11i_zhs.zip   ;unzip p4262360_11i_GENERIC.zip

法二:

#find . -name '*.zip' -exec unzip {} ;

法三:

#ls *.zip | xargs -n1 unzip

法四:(借用一个循环)

# for i in *

> do

> unzip $i

> done

 

--------------------------------------------------

 

Bash下每个用户都可以配置两个初始文件:.bash_profile和.bashrc。man bash中的相关解
释如下:

,------------------------------------------------------------
| ~/.bash_profile
| The personal initialization file, executed for login shells
| ~/.bashrc
| The individual per-interactive-shell startup file
`------------------------------------------------------------

以前一直没细想两者的区别,今天整理了一下。

* 每次bash作为login shell启动时会执行.bash_profile。

主要有(我所知道的)有以下几种情形:

a) 每次登录到服务器时默认启动的shell

b) “su -l [USER]”时进入的shell

c) “bash --login”进入的shell

* 每次bash作为普通的交互shell(interactive shell)启动时会执行.bashrc

常见的有:

i) “su [USER]”进入的shell
ii) 直接运行“bash”命令进入的shell

** 注意

1, 在shell脚本中“#!/usr/bin/bash”启动的bash并不执行.bashrc。因为这里的bash不是
interactive shell

2, bash作为login shell(login bash)启动时并不执行.bashrc。虽然该shell也是interactive shell
但它不是普通的shell

* 一般.bash_profile里都会调用.bashrc

尽管login bash启动时不会自动执行.bashrc,惯例上会在.bash_profile中显式调用.bashrc

,-------------------------------------
| if [ -f ~/.bashrc ]; then
| . ~/.bashrc
| fi
`-------------------------------------

* 试验脚本

用以下文件可以很方便的验证以上所述。

,-------------------------------------
| -bash-2.05b$ cat .bashrc
| echo "in bashrc"
| export TEST="rc"
|
| -bash-2.05b$ cat .bash_profile
| echo "in bash profile"
|
| -bash-2.05b$ cat test.sh
| #!/bin/bash
| echo $TEST
| bash-2.05b$
`-------------------------------------
 


 

 

posted @ 2011-09-05 15:00  规格严格-功夫到家  阅读(169)  评论(0编辑  收藏  举报