随笔分类 -  shell(gameitem)

摘要:八、流编辑器sed 8.1 sed简介 sed是stream editor的缩写,一种流编辑器,它一次处理一行内容。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的内容送往屏幕。接着处理下一行,这样不 阅读全文
posted @ 2017-01-06 11:49 Mr.Eric 阅读(222) 评论(0) 推荐(0)
摘要:shell中截取字符串的方法有很多中, ${expression}一共有9种使用方法。 ${parameter:-word} ${parameter:=word} ${parameter:?word} ${parameter:+word} 上面4种可以用来进行缺省值的替换。 ${#parameter 阅读全文
posted @ 2017-01-05 16:47 Mr.Eric 阅读(133) 评论(0) 推荐(0)
摘要:shell中${}的妙用 1. 截断功能 ${file#*/}: 拿掉第一条/及其左边的字符串:dir1/dir2/dir3/my.file.txt ${file##*/}: 拿掉最后一条/及其左边的字符串:my.file.txt ${file#*.}: 拿掉第一个.及其左边的字符串:file.tx 阅读全文
posted @ 2017-01-05 16:46 Mr.Eric 阅读(218) 评论(0) 推荐(0)
摘要:tar命令和ssh配合使用 tar命令和ssh配合使用 如何在空间不是很富裕的情况,把文件从一个分区tar到另外一个分区,其实还有很多办法的,使用管道命令就可以实现 如: #tar -cvf home |(cd /datavg35; tar -xvf -) 把home文件打包并解压到/datavg3 阅读全文
posted @ 2017-01-05 16:40 Mr.Eric 阅读(1253) 评论(0) 推荐(0)
摘要:xargs -i 参数或者-I参数配合{}即可进行文件的操作。 -I replace-str Replace occurrences of replace-str in the initial-arguments with names read from standard input. Also, 阅读全文
posted @ 2017-01-05 16:36 Mr.Eric 阅读(743) 评论(0) 推荐(0)
摘要:find -maxdepth 1 -regextype posix-extended -type f -regex "\./${name}[-\.].*\.(gz|bz2|tgz|zip|tar)" -exec basename {} \; find中使用正则表达式的语法是 find dir -re 阅读全文
posted @ 2017-01-05 16:01 Mr.Eric 阅读(283) 评论(0) 推荐(0)
摘要:1) 为何叫做 shell ?在介绍 shell 是甚幺东西之前,不妨让我们重新检视使用者与计算机系统的关系:图(FIXME)我们知道计算机的运作不能离开硬件,但使用者却无法直接对硬件作驱动,硬件的驱动只能透过一个称为"操作系统(Operating System)"的软件来控管,事实上,我们每天所谈 阅读全文
posted @ 2017-01-05 15:35 Mr.Eric 阅读(530) 评论(0) 推荐(0)