#!/bin/bash
#随机取出res目录下20个大于50K的图片并输出其名称
res=(`findres/-name"*.png"-size+50k-o-name"*.jpg"-size+50k`)
tmp_file="/tmp/temp_res.txt"
touch$tmp_file
>$tmp_file
while[[`uniq$tmp_file|wc-l`!=20]]
do
echo`expr$RANDOM%${#res[@]}`>>$t..
分类:
其他好文 时间:
2014-12-22 02:07:10
阅读次数:
205
function return value,&& ||
分类:
系统相关 时间:
2014-12-21 17:51:58
阅读次数:
190
Python Django 调试 >>> class Person(models.Model): ... first_name = models.CharField(max_length = 50) ... last_name = models.CharField(max_length = 50) ... def __unicode__(self): ... return u‘%s %s...
分类:
编程语言 时间:
2014-12-21 16:44:34
阅读次数:
499
一、概述read命令接收标准输入(键盘)的输入,或者其他文件描述符的输入。得到输入后,read命令将数据放入一个标准变量中。二、使用举例(这里仅列出一些常用的选项)1.基本读取#!/bin/bash echo -n "Enter your name:" #参数-n的作用是不换行,...
分类:
系统相关 时间:
2014-12-21 16:25:01
阅读次数:
194
通常作为一个应用程序的部署脚本,开始的第一项工作是为当前应用创建一个专用(dedicated)的用户和用户组。这个脚本很简单,这里贴一个参考样本:#!/bin/sh
user=test_user
group=test_group
#create group if not exists
egrep "^$group" /etc/group >& /dev/null
if [ $? -ne 0 ]
...
分类:
系统相关 时间:
2014-12-21 15:22:24
阅读次数:
223
RHEL自动安装zookeeper的shell脚本A:本脚本运行的机器,Linux RHEL6B,C,D,...:待安装zookeeper cluster的机器, Linux RHEL6首先在脚本运行的机器A上确定可以ssh无密码登录到待安装zk的机器B,C,D,...上,然后就可以在A上运行本脚本:$ ./install_zookeeper 2181 B C D前提:B, C, D机器必须配置好...
分类:
系统相关 时间:
2014-12-21 12:45:46
阅读次数:
233
date在shell中常用的语法常见的参数:%Y显示年份%m显示月份%d显示日期%H显示小时%M显示分钟%S显示秒%x显示年月份%X显示时分秒查看当前系统时间[root@fuzj-linux~]#date2014年08月10日星期日16:48:04CST查看年,月,日[root@fuzj-linux~]#date+%Y查看当前年份2014[root@fuzj-lin..
分类:
其他好文 时间:
2014-12-21 01:57:31
阅读次数:
194