echo
"$(date "+%y%m%d")=true" > financials.log
tail -n 1 financials.log
# 賦值給變數
finc_flag=$(tail -n 1 financials.log)
sed -n 1p financials.log|cut -d ' '
-f1 # 第一行第一列
# 賦值給變數
finc_flag=$(sed -n 1p financials.log|cut -d ' '
-f1)
myoutputfileflag="financials.log"
finc_flag=$(tail -n 1 $myoutputfileflag)if
[["$finc_flag" == "$(date "+%y%m%d")=true"]]
;then
single_table_transform_handler.ksh dw_clsfd.stt_clsfd_bsc_finc_data_w_tmp
fi
if
[-f "$myinputfile"
]; then
echo
"$(date "+%y%m%d ttt")=true" > $myoutputfileflag
#>>追加寫入 > 覆蓋寫入
echo
"$(date "+%y%m%d")=true" >> $myoutputfileflag
echo
"file $myoutputfile finished writing"
else
echo
"$(date "+%y%m%d")=true" > $myoutputfileflag
echo
"file $myinputfile does not exist"
fi
shell 實現讀取檔案某行的內容
shell獲取檔案最後一行
shell中if判斷資料夾或檔案是否存在!
常用shell命令操作
1.判斷2個目錄同時存在再執行shell命令 bin bash testpath volume01 edit high testpath1 volume01 bak edit high if d testpath d testpath1 then echo ok rsync a delete vol...
shell常用操作命令系列 軟體操作命令
rpm常用操作 rpm ivh lynx rpm安裝 rpm e lynx 解除安裝包 rpm e lynx nodeps 強制解除安裝 rpm qa 檢視所有安裝的rpm包 rpm qa grep lynx 查詢包是否安裝 rpm ql 軟體包路徑 rpm uvh 公升級包 rpm test ly...
shell檔案操作相關命令
1,在 opt目錄 下新建乙個資料夾,名字叫new folder,並且把 etc init.d中的所有檔案拷貝到這個資料夾中。sudo cp r etc init.d opt new folder 2,把new foleder分別壓縮為new folder.tar.gz和new foleder.ta...