source命令用法:source FileName作用:在当前bash环境下读取并执行FileName中的命令。注:该命令通常用命令“.”来替代。如:source .bash_rc 与 . .bash_rc 是等效的。source命令(从 C Shell 而来)是bash shell的内置命令。点...
分类:
系统相关 时间:
2014-07-07 22:15:15
阅读次数:
293
以前一直做Windows开发,近期的项目中要求使用Linux。作为小菜鸟一枚,赶紧买了一本经典书《鸟哥的Linux私房菜》学习。最近刚好有一个小任务 - 由于产品产生的Log很多,而且增长很快,所以需要用脚本(Bash scripts)删除过期的Log文件。 使用Linux下的Cron Job...
分类:
系统相关 时间:
2014-07-01 19:48:48
阅读次数:
401
在centos6.X和redhat enterprise 中安装chrome,我找了很久都不行,今天终于找到了可以用下脚本那安装:#! /bin/bash# Google Chrome Installer/Uninstaller for CentOS 6 or 7# (C) Richard K. L...
分类:
其他好文 时间:
2014-07-01 13:00:23
阅读次数:
378
1. 先介绍下alias(别名)的用法
alias la='ls -a' alias b='cd ..' 等等
alias 是个好东西,可以在用shell省很多时间
2. 但有一天我发现执行shell脚本的时候,if 语句不能用了,会报一下错误:
bash: build/envsetup.sh: line 30: syntax error near une...
分类:
其他好文 时间:
2014-07-01 07:26:00
阅读次数:
214
Ø 读取文件的时间
#!/bin/bash
for file in `ls /root`
do
stat $file>1.txt
sed -n "7p" 1.txt>2.txt
usetime= awk -F ":" '{print $2}' 2.txt
echo "time="$file $usetime
done
Ø 读取文件的每行while...
分类:
其他好文 时间:
2014-07-01 06:49:51
阅读次数:
204
start.shJava代码#!/usr/bin/bash##start.sh#@auth:zhoulin@lianchuang.com#SERVER_STATUS(){serv_status=`ps-ef|grepweblogic|grepwebapp|grep-vgrep|grep$1|wc-l...
分类:
Web程序 时间:
2014-06-30 23:05:20
阅读次数:
578
创建命令f1
创建一个shell脚本 f1,放到 $PATH 可以找到的位置:
{CSDN:CODE:411063}
f1用法
1. 创建一个文件 foo.txt,并 backup 它
$ cat foo.txt
1
$ f1 backup foo.txt
2. 修改它
$ cat foo.txt
2
3. 还原到上一个版本
$ f1 ...
分类:
其他好文 时间:
2014-06-30 17:04:38
阅读次数:
228
今日在微博看到如此神奇的代码,居然还有新的sort算法,对于我这种渣渣必须研究一下,代码如下:
#!/bin.bash
function f()
{
sleep "$1" //sleep 这么多ms
echo "$1"
}
while [ -n "$1" ] //第一个参数不为空
do
f "$1" & //后台运行,相当于fork一个进程去执行f, 父进程同...
分类:
其他好文 时间:
2014-06-30 08:41:57
阅读次数:
256
首先来看看变量的问题
[root@localhost ~]# dhh=1
[root@localhost ~]# echo $dhh
1
开一个子shell测试
[root@localhost ~]# bash
[root@localhost ~]# echo $dhh
没有值
使用export
[roo...
分类:
系统相关 时间:
2014-06-30 00:53:44
阅读次数:
270
21、git tag tagname:创建标签
22、git show tagname:查看标签信息。注意:标签不是按时间顺序列出,而是按字母排序的。
23、git tag -a tagname -m tagdesc:创建带说明的标签
24、git tag -d tagname:删除指定标签
25、git push origin tagname:推送某个标签到远程仓库
26、git push origin --tags:一次性推送全部尚未推送到远程的本地标签
27、git push origin...
分类:
其他好文 时间:
2014-06-29 23:40:56
阅读次数:
360