This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int num; | |
int i,j; | |
printf("请输入您想生成的三角形高度: "); | |
scanf("%d",&num); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
char i,j,k; | |
for(i = 0; i < 6; i++) | |
{ | |
for(j = 'F',k = 0; j >= 'A',k <=i; j--,k++) //一个for里可以干多件事情,相反也行. | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <ctype.h> | |
#define STOP '|' | |
int main(void) | |
{ | |
char c; | |
char prev; | |
long n_chars = 0L; | |
int n_lines = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main(int argc,char *argv[]) | |
{ | |
int source; | |
int sum = 0; | |
source = atoi(argv[1]); | |
while(source/10) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOG_DIR=/var/log | |
ROOT_UID=0 | |
LINES=50 | |
E_XCD=66 | |
E_NOTROOT=67 | |
if [ "$UID" -ne "$ROOT_UID" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
去掉最后一个字符 | |
time1=${time1%?} | |
date命令 | |
##begin | |
date +'%H:%M' 后面是输出格式 | |
date -d'1 minute ago' +'%H:%M' 时间先做偏移,再按照格式输出,这个加号不可少 | |
##end | |
时间做比较,其实是比较字符串。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#delete file which size equal zero | |
ls -l > .ll.txt | |
while read dt | |
do | |
size=`echo "$dt" | awk '{print $5}'` | |
if [ "$size" == "0" ] | |
then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
File=/etc/fstab | |
{ | |
read line1 | |
read line2 | |
} < $File | |
echo "First line is $line1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SUCCESS=0 | |
E_NOARGS=65 | |
if [ -z "$1" ] | |
then | |
echo "Usage:`basename $0` rpm-file" | |
exit $E_NOARGS | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BACKUPFILE=backup.$(date +%Y%m%d) | |
archive=${1:-$BACKUPFILE} | |
tar cvf - `find -mtime -1 -type f -print` > $archive.tar | |
# find . -mtime -1 -type f -exec tar rvf "$archive.tar" '{}' \; |
OlderNewer