Unix Shell
zmycoco2
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
展开
-
Get previous business day
$ vi getdate.ksh#!/bin/kshif [[ $(date +%w) == 1 ]]then LOOK_BACK=3else LOOK_BACK=1fikeydate=`date -d "${LOOK_BACK} day ago" +%Y/%m/%d`echo $keydate原创 2013-05-28 13:12:48 · 934 阅读 · 0 评论 -
查找shell所在的位置
cat /etc/shells会列出说有本机可以使用的shell原创 2014-01-16 09:44:56 · 830 阅读 · 0 评论 -
检查Linux机器的内存使用状况之Shell脚本实现
检查Linux机器的内存使用状况之Shell脚本实现原创 2014-01-23 14:39:01 · 1962 阅读 · 0 评论 -
linux下的文件名空格处理
linux下的文件名空格处理原创 2013-10-14 14:03:36 · 15704 阅读 · 0 评论 -
install_oprisk_rpm.sh
#ident "%W%"getInstallType(){ RESP="" while [ -z "${RESP}" ] do echo -e " The package has nine different install types. They are: 1 - stable1 i原创 2013-08-21 14:18:00 · 990 阅读 · 0 评论 -
SubmitetoHermes.ksh
#!/bin/bash#ident "%W%"printMessage() {echo -e "\n************************************************************"echo -e "$1"echo -e "$1" >> ${LOG_DIR}/${LOG_FILE}}printMessage2()原创 2013-08-07 10:52:31 · 1303 阅读 · 0 评论 -
Function Menu use Shell
Function Menu use Shell原创 2013-08-07 10:27:41 · 1191 阅读 · 0 评论 -
Shell 遍历字符串与参数
Shell 遍历字符串与参数原创 2013-07-04 16:13:20 · 2115 阅读 · 0 评论 -
Shell split character line by line
while read line do account=`echo "$line"| cut -c1-9`'|' account+=`echo "$line"| cut -c10-44`'|' account+=`echo "$line"| cut -c45-45`'|' account+=`原创 2013-06-28 15:54:20 · 1034 阅读 · 0 评论 -
remove a directory which is not empty
rm -rf targetDirectory原创 2013-06-25 11:47:35 · 1125 阅读 · 0 评论 -
build shell script example, from checkout to build to hermes
#!/bin/ksh#if [ $# -lt 1 ]; then# echo "please add product id in here, like 102489 it is HnwBchDR_LA product id"# exit 1;#fiecho "Start to access XENV use product id 102489, wait a mom原创 2013-06-25 13:44:19 · 1522 阅读 · 0 评论 -
unix find command tutorial and sample code
显示20分钟前的文件find /home/prestat/bills/test -type f -mmin +20 -exec ls -l {} \;删除20分钟前的文件find /home/prestat/bills/test -type f -mmin +20 -exec rm {} \;显示20天前的文件find /home/prestat/bills/test原创 2013-06-24 09:21:51 · 1208 阅读 · 0 评论 -
How to find variable is empty in shell script
(1).var=""if [ -n "$var" ]; then echo "not empty"else echo "empty"fi(2).function empty{ local var="$1" # Return true if: # 1. var is a null string ("" as empt原创 2013-06-19 14:27:20 · 1334 阅读 · 0 评论 -
Startup a JAVA standalone program in UNIX use shell script
chkpid=`ps -ef | grep [H]NWFileAnalysis | wc -l`if [ $chkpid -gt 0 ] ; then ./stopHNWFileAnalysis.sh fiif [ -z "$JAVA_HOME" ] ; then `grep export setenv-java.sh`fiBASEDIR=`dirname原创 2013-06-18 08:44:36 · 1698 阅读 · 0 评论 -
Shell if elif else Code Example
export servername=`uname -n`export serverlen=${#servername}export serverenv=`echo $servername | cut -c$serverlen`if [[ $serverenv=='d' ]]; then export SQL_GOLDEN=STEP_DEV_NY_DS expor原创 2013-06-18 08:45:41 · 1333 阅读 · 0 评论 -
标准shell script示例
#!/bin/ksh##############################################################NAME - ##DESCRIPTION - ####FUNCTION CALLS DEFINED## - cleanup - ## - isql_exec - ## - isql_原创 2013-05-30 12:36:01 · 940 阅读 · 0 评论 -
BCP utility in Sybase(Unix Environment)
We can use below command for bcp out a table to *.dat file,$SYB_BIN/bcp hnwreport.dbo.TblHNWCustomer out ${SYB_DATA}/${TABLE}.prod.dat -I/opt/muni/HNWEnv/HNW_interfaces.txt -U hnwuser -P Lip0v123 -S原创 2013-05-28 13:11:12 · 903 阅读 · 0 评论 -
SFTP的应用
SSH File Transfer Protocol(SFTP) is a network protocol that provides file access, file transfer, and file management functionalities over any reliable data stream. SFTP为SSH的一部分,是一种传输档案至Blogger服务器的原创 2013-05-29 19:41:41 · 1007 阅读 · 0 评论 -
如何在Linux中增加默认变量
如何在Linux中增加默认变量原创 2014-02-27 09:03:39 · 886 阅读 · 0 评论