计算1-100的和[root@www~]#cat100.sh#!/bin/bashsum=0forain`seq1100`;do sum=$[$sum+$a]done echo$sum[root@www~]#sh100.sh5050上面是直接显示总和下面列出计算结果[root@www~]#cat100.sh#!/bin/bashsum=0forain`seq1100`;do sum=$[$sum+$a] echo$sumdone[root@www~]#sh100.sh..
分类:
系统相关 时间:
2014-11-10 10:11:34
阅读次数:
252
1. login shell 和 non-login shell
login shell 和 non-login shell 区别在于登录 login。
login shell : 通过完整的登录流程
non-login shell : 取得bash接口的方法不需要重复登陆,
/etc/profile
这个配置为用户整体的配置
bash读取完整体环境变量/etc/profile 后会读取个人用户配置。主要有下面三个文件:
1. ~/.bash_profile
2. ~/.bash_login
3. ~/....
分类:
其他好文 时间:
2014-11-10 10:07:29
阅读次数:
207
1. 重定向
执行一个命令,有输入,有输出。
标准输入: standard input ,检查 stdin , 代码为0, 使用< 或 < 或 >>
标准错误输出; standard error output. 简称:stderr, 命令执行返回的错误信息。 代码为2, 使用 > 或 >>
默认都输出到屏幕上。...
分类:
系统相关 时间:
2014-11-10 10:06:46
阅读次数:
271
写了一个程序,用来判断一个文件是否存在:#includemain(){FILE *fp;fp = fopen ("/home/wang/my/ct2.c", "r+");if (fp == NULL){printf("there is not this file!\n");}elseprintf("...
分类:
其他好文 时间:
2014-11-10 06:25:34
阅读次数:
131
atexit(设置程序正常结束前调用的函数)相关函数_exit,exit,on_exit表头文件#include定义函数int atexit (void (*function)(void));函数说明atexit()用来设置一个程序正常结束前调用的函数。当程序通过调用exit()或从main中返回时...
分类:
系统相关 时间:
2014-11-10 06:25:20
阅读次数:
312
#include void main(){int a,b,c,y,g,f;printf("圆柱底面的半径,圆柱的高");scanf("%d %d",&a,&b); c=2*3.14*a;y=3.14*a*a;g=c*b;f=2*y+g; printf("圆柱底面的周长为%d",c);printf("...
分类:
编程语言 时间:
2014-11-09 19:30:47
阅读次数:
258
SHELL脚本编程---判断1、条件判断条件判断在bash分为整数判断,字符判断和文件判断。1-1条件判断的表达式:①[expression](注意单词词头和词尾都需要空格)②[[expression]](注意同上)③testexpression1-2整数比较①-eq测试两个数是否相等,相等为真,不等为假②-ne测试两个数是..
分类:
系统相关 时间:
2014-11-09 18:12:11
阅读次数:
642
概述系统性能一直是一个受关注的话题,如何通过最简单的设置来实现最有效的性能调优,如何在有限资源的条件下保证程序的运作,ulimit 是我们在处理这些问题时,经常使用的一种简单手段。ulimit 是一种 linux 系统的内键功能,它具有一套参数集,用于为由它生成的 shell 进程及其子进程的资源使用设置限制。本文将在后面的章节中详细说明 ulimit 的功能,使用以及它的影响,并以具体的例子来详...
分类:
其他好文 时间:
2014-11-09 12:40:49
阅读次数:
295
RemshThere’s a mechanism entirely similar to the one available through the JCL mode, although invoked in a different manner. The entire JCL mode sequence can by bypassed by starting the shell as follo...
分类:
其他好文 时间:
2014-11-09 11:19:02
阅读次数:
186
连接到远程节点Interacting with a running server program is traditionally done in one of two ways. One is to do it through an interactive shell kept available by using a screen or tmux session that runs in th...
分类:
其他好文 时间:
2014-11-09 09:56:37
阅读次数:
127