#include#include#include#define random(x)
(rand()%x)void main(){ srand((int)time(0)); for(int x=0;x<10;x++)
printf("%d/n",random(100...
分类:
编程语言 时间:
2014-06-29 15:34:25
阅读次数:
302
首先要说明的是,不要使用which来进行判断,理由如下:1、which非SHELL的内置命令,用起来比内置命令的开销大,并且非内置命令会依赖平台的实现,不同平台的实现可能不同。#
type typetype is a shell builtin# type commandcommand is a s...
分类:
其他好文 时间:
2014-06-29 15:27:20
阅读次数:
1334
最近写了一个shell脚本,用到了cp、time、cut、awk命令,把他们的使用方法给写下来:1.cp和mvcp命令:用来完成文件的复制,从源文件夹复制到目标文件夹。执行后源文件夹和目标文件夹均有源文件。mv
命令:用来移动文件。执行后,源文件夹中没有源文件。我经常用mv命令来重命名文件注意:cp...
分类:
系统相关 时间:
2014-06-29 14:03:19
阅读次数:
5085
#include using namespace std;int main(){#if 1
int num = 12345; char str[25];//不要写成char*,因为没有分配空间 itoa(num, str, 10);//10进制字符串
printf("num ...
分类:
其他好文 时间:
2014-06-07 03:32:09
阅读次数:
215
/*设计一个函数,找出整型数组元素的最大值*/#includeintmaxOfArray(intarray[],intlength){//数组当做函数参数传递时,会当做指针变量来使用,指针变量在64bit编译器环境下,占据8个字节//intsize=sizeof(array);//printf("a...
分类:
其他好文 时间:
2014-05-28 16:32:39
阅读次数:
223
/*设计一个函数,用来计算b的n次方递归的2个条件:1.函数自己调用自己2.必须有个明确的返回值*/#includeintpow2(intb,intn);intmain(){intc=pow2(3,2);printf("%d\n",c);return0;}/*pow2(b,0)==1pow2(b,1...
分类:
其他好文 时间:
2014-05-28 15:33:39
阅读次数:
418
/*编写一个函数,判断某个字符串是否为回文。回文就是从左边开始读 和 从右边开始读
都是一样的,比如"abcba"*/#include #include int isHuiwen(char *str);int main(){
printf("%d\n", isHuiwen("a")); ...
分类:
其他好文 时间:
2014-05-28 15:11:59
阅读次数:
299
echo
192.168.10.69>>ip.list-------------------------------------------#!/bin/bash#注意if和[]之间的空格rm
-f ~/fanr/shell/DiskUsageAlert/out.printout=$(cat ~/f...
分类:
系统相关 时间:
2014-05-28 14:54:26
阅读次数:
391
前面省略连接部分…… cat narnia2.c #include #include
#include int main(int argc, char * argv[]){ char buf[128]; if(argc == 1){
printf("Usage: %s argument\n", ar...
分类:
其他好文 时间:
2014-05-28 11:49:49
阅读次数:
560
一、if判断数字: $A=12 $B=15 if(("$A"<"$B"))
if(("$A"=="$B"))字符串: $A="HELLO" $B="WORLD" if [ "$A" = "FACT_LOGIN_USER" ] if [
"$A" = "$B" ]PS:字符串比较的时候...
分类:
其他好文 时间:
2014-05-28 09:32:44
阅读次数:
347