shell
chaehom
这个作者很懒,什么都没留下…
展开
-
用sed清除文本的空行和行首空格
用脚本 clean.sh#!/bin/sh sed -i "s/^[[:space:]]*//g" $1 sed -i "/^$/d" $1 ./clean.sh file.txt原创 2012-07-30 10:40:18 · 1202 阅读 · 0 评论 -
CGI调用system(cmd) 返回256的原因
这几天在做CGI页面的时候碰到一个问题。。 主要是通过cgi程序,调用linux里的shell脚本进行一些系统配置。 流程是这样的: 1.页面表单提交到页面 x.cgi 2.x.cgi 收到传递过来的参数后,生成调用 shell 脚本的命令 cmd 3.调用 system( cmd ) 函数,执行命令,如果成功返回0,失败返回错误码 4.根据 system( cmd ) 的执行原创 2012-09-12 20:48:15 · 13156 阅读 · 3 评论 -
bash & dash
原来我的ubuntu的sh指向的是dash。。。怪不得有些bash的命令用不了。。。原创 2012-09-13 21:11:57 · 418 阅读 · 0 评论 -
用tc+iptables+HTB解决ADSL宽带速度瓶颈技术
自己写的流量控制档 tc2 欢迎转发交流,但请注明原出处信息.powered by KindGeorge. http://kindgeorge.at.3322.org #!/bin/bash #脚本文件名: tc2 ##########################################################################转载 2012-10-12 15:21:35 · 967 阅读 · 0 评论 -
设置vim缩进
记录一下,免得又忘了 打开vimrc配置文件,添加这句 autocmd FileType c,cpp set shiftwidth=4 | set tabstop=4 | set cin 注: tabstop tab符等同的空格长度 shiftwidth 自动缩进时的空格长度 softtabstop tabstop和shiftwidth设置长度不一样时可用(tab符与空原创 2012-10-31 10:12:16 · 361 阅读 · 0 评论 -
shell中获取本机ip地址
方法一: /sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" or /sbin/ifconfig|sed -n '/inet addr/s/^[^:]*:\([0-9.]\{7,15\}\) .*/\1/p' 方法二: loca转载 2013-04-11 20:14:52 · 2154 阅读 · 0 评论 -
mdev实现U盘和SD卡的自动挂载
1)确保内核支持热插拔 # cd linux-2.6.30.4# vi .config CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set # CONFIG_KALLSYMS_EXTRA_PASS is not set # CONFIG_STRIP_ASM_SYMS is not set CONFIG_HOTPLUG=y //确保这项为转载 2013-04-15 19:49:52 · 729 阅读 · 0 评论