# -*- coding: utf-8 -*-import osimport subprocessimport signalclass MockLogger(object): '''模拟日志类。方便单元测试。''' def __init__(self): self.info...
分类:
编程语言 时间:
2014-09-17 10:07:01
阅读次数:
388
Shell应用技巧 小技巧: 1、命令补全功能: 键 2、清屏: Ctrl+l 3、删除光标前所有内容: Ctrl+u 4、命令历史记录: history 这时: !history所列出的命令标号,就可以执行那条命令。 如: !188 而且: 按方向键↑和↓可查找以前执行过的命令。 重要技巧:1、命令别名: 作用: 可以使操作更加容易,命令能够更加容易记忆。 alias: 显示系统已经定义...
分类:
系统相关 时间:
2014-09-16 22:12:11
阅读次数:
330
--------------------linux命令 实现某一功能指令或程序 命令行执行依赖于解释器linux命令的分类 内部命令 属于shell解释器一部分 /bin/bash 外部命令 独立与shell解释器只爱的程序文件---------------命令...
分类:
系统相关 时间:
2014-09-16 22:00:31
阅读次数:
264
http://www.cnblogs.com/xiaowenji/archive/2011/03/12/1982309.html大家是否有过这样的经历,在命令行里输入adb shell,然后使用命令操作你的手机或模拟器,但是那些命令都是常见Linux命令的阉割缩水版,用起来很不爽。是否想过在Andr...
分类:
移动开发 时间:
2014-09-16 21:55:51
阅读次数:
273
[root@jbossshell]#catgetopts.sh#!/bin/bash#date=2014-09-16#istopracticethegetoptswhilegetopts"a:bc"arg(:前面的变量是一定要跟参数的)do case$argin a) echo"a‘sarg:$OPTARG" ;; b) echo"b" ;; c) echo"c" ;; ?) echo"unkownargument" exit1 ;; esacdone[root@j..
分类:
其他好文 时间:
2014-09-16 19:09:31
阅读次数:
205
sed中引入shell变量的四种方法1.evalsed’s/$a/$b/’filename2.sed"s/$a/$b/"filename3.sed’s/’$a’/’$b’/’filename4.seds/$a/$b/filename
分类:
其他好文 时间:
2014-09-16 19:08:51
阅读次数:
165
[root@jbossshell]#catshift.sh#!/bin/bashuntil[$#-eq0];doecho"thefirstis:$1totalis$#"shiftdone[root@jbossshell]#./shift.sh123456thefirstis:1totalis6thefirstis:2totalis5thefirstis:3totalis4thefirstis:4totalis3thefirstis:5totalis2thefirstis:6totalis1[root@jbos..
分类:
其他好文 时间:
2014-09-16 19:07:41
阅读次数:
147
该Shell脚本用于实现将DB2数据库表导出到文件,将在另一篇博文《Java代码调用Shell脚本并传入参数实现DB2数据库表导出到文件》中通过Java代码实现调用该脚本并传入参数。#!/usr/bin/envsh
DBSCHEMA=$1
DBUSER=$2
DBPASSWORD=$3
TABLENAME=$4
FILEPATH=$5
DELIMITER=$6
EXPORTL..
分类:
数据库 时间:
2014-09-16 19:07:21
阅读次数:
273
本文通过Java代码调用Shell脚本并传入参数实现DB2数据库表导出到文件,代码如下:importjava.io.File;
importjava.io.IOException;
importjava.io.InputStreamReader;
importjava.io.LineNumberReader;
importjava.util.HashMap;
importorg.slf4j.Logger;
importorg.slf4j.Log..
分类:
数据库 时间:
2014-09-16 19:06:21
阅读次数:
320
最近同事写的shell脚本在ubuntu上跑时总走不对if的分支。发现ubuntu上的shell默认是bash,但sh对应的是dash,这个需要注意。
1
ubuntu上sh连到dash:
zxw@hostname1:~$ uname -a
Linux hostname1 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17...
分类:
其他好文 时间:
2014-09-16 17:24:31
阅读次数:
293