![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Shell
文章平均质量分 54
thmono
这个作者很懒,什么都没留下…
展开
-
shell 中 shift 位移
#用shift操作来计算输入的各项之和#!/bin/shif [ $# -eq 0 ]thenecho "usage: sh sum.sh 1 2 3 4 5 "exitfisum=0until [ $# -eq 0 ]do#注意 +号与数字两边都有空格 此处前面的sum是要对它进行赋值#所以不用在前面添加$sum=`expr $sum + $1`原创 2009-10-13 22:22:00 · 1279 阅读 · 0 评论 -
自动登录FTP脚本
<br />##FTP自动上传<br />##用法: FTP 文件名<br />#!/bin/sh <br />ftp -n<<! <br />open 10.247.3.153<br />user zhang hello123@ <br />bin<br />prompt off <br />cd /home/huzheng/fujian/ <br />mput $1 <br />close <br />bye <br />!<br /><br /><br原创 2010-11-02 22:01:00 · 837 阅读 · 0 评论 -
shell脚本 20101102
<br />#前三个月<br />year=`date +%Y`<br />mon=`date +%m`<br />if [ $mon -lt '04' ]<br />then<br />mon=`expr $mon + 9`<br />year=`expr $year - 1`<br />else<br />mon=`expr $mon - 3|awk '{printf("%02d/n",$0)}'`<br />fi<br />validbillcyc=$year$原创 2010-11-02 22:09:00 · 1358 阅读 · 0 评论 -
sqlplus dbtool自动登录脚本
<br /><br />shell中调用sqlplus<br />sqlplus -s user/pwd@datebase<<EOF>/dev/null<br />spool b.txt<br />select * from a;<br />spool off<br />exit<br />EOF<br />cat b.txt|tr -d ''>b.txt<br />shell中调用dbtool<br />/dxyyt/kefu/dbtool cxtyd_rw/tyd原创 2010-11-01 19:46:00 · 1205 阅读 · 0 评论 -
linux笔记 20101130
<br />awk '{if(length($1)>10) print substr($1,1,10);else print $1} test1;<br />名字服务器 可以根据域名查IP linux和windows都可以使用 nslookup www.sina.com<br />awk中打印单引号 echo "a" |awk '{print "/47"$1"/47"}' <br />AIX <br /> 查看内存 topas vmstat vmstat 2 10 每个两秒出一次原创 2010-11-30 09:43:00 · 558 阅读 · 0 评论 -
ksh 案例
<br />Ksh Scripting<br /><br />--------------------------------------------------------------------------------<br /><br />Contents<br />Principle of Script<br />Variables<br />Branching<br />Looping<br />Commandline Arguments<br />Comparisons<br />Variabl原创 2010-09-21 22:14:00 · 876 阅读 · 0 评论 -
shell && sql 交互脚本
<br />shell中调用sqlplus<br />sqlplus -s user/pwd@datebase<<EOF>/dev/null<br />spool b.txt<br />select * from a;<br />spool off<br />exit<br />EOF<br />cat b.txt|tr -d ''>b.txt<br /><br />shell中调用dbtool<br />/dxyyt/kefu/dbtool cxtyd_rw/tyd4321@gdsm2 -f[$sqldi原创 2010-09-21 22:02:00 · 622 阅读 · 0 评论 -
example of while [ ]
#usage: make 10 directorys and change file mode bits#name: mkdir.sh#!/bin/sh i=1#be careful the space between "[" $i and whilewhile [ $i -le 10 ]doif [ -d /home/thmono/mkdir ]; thenmk原创 2010-01-03 22:29:00 · 434 阅读 · 0 评论 -
note of SHELL (四)
#--------------------------------------------------------------###!/bin/shline_length=20line_count=$1char="*" function usage{ name=$(basename $0) echo -e "usage:$name line_count_number/n" exit 1}原创 2010-02-18 21:54:00 · 580 阅读 · 0 评论 -
note of SHELL (二)
#------------------------------------------------------------#name:call_file.sh#note:call shell file#!/bin/shif [[ -f "test.sh" ]] ;then sh countdown.sh 5 else echo -e "file is no ex原创 2010-02-18 21:50:00 · 458 阅读 · 0 评论 -
note of SHELL (三)
#----------------------------------------------------#name:time_counter.sh#note:echo time escape#!/bin/shtime=$1argc=$#if [ ! $argc -eq 1 ] ;then echo -e "usage:$0 time_remain/n" exit 1fiif [[ $原创 2010-02-18 21:51:00 · 442 阅读 · 0 评论 -
Bash选项
缩写 名称 作用 -C noclobber 防止重定向时覆盖文件(可能会被>|覆盖) -D (none) 列出用双引号引用起来的, 以$为前缀的字符串, 但是不执行脚本中的命令 -a allexport export(导出)所有定义过的变量 -b notify 当后台运行的作业终止时, 给出通知(脚本中并不常见)原创 2010-01-25 23:06:00 · 1528 阅读 · 0 评论 -
note of SHELL (一)
#----------------------------------------#note:copy suffix with character "r" or "g"# to "../test" directory#!/bin/shfor file in [rg]* ;do mv $file ../test done#------------------------------原创 2010-01-20 00:31:00 · 521 阅读 · 0 评论 -
shell脚本 20101102(二)
<br />for和case的混合运用<br />set -A region hz hy mz gz yf qy zq sg jm mm zj yj st sw jy cz fs zs zh sz dg<br />for loop in ${region[*]}<br /> do <br /> <br /> print "select "123$loop," count(*) from "$loop"zw.sp_hlr_resu原创 2010-11-02 22:15:00 · 1214 阅读 · 0 评论