我是unix的新手。但我需要理解客户给出的这段代码:(。我试图询问客户关于代码的详细信息,比如代码应该做什么,但他自己不知道。所以基本上我被一个我做的目的代码卡住了不知道,但我必须了解它的作用>.<。这是我迄今为止能够从代码中得出的结果(以评论的形式)[1] [2] [3] 等等。我有评论编号 [8] 到 [12] 的疑问/没有线索。对于 [1] 到 [7],我觉得大多数是正确的,但如果有任何错误,请随时指出。一点背景:我应该在teradata,这可能与它有关。我的评论是粗体的{ *}
#!/usr/bin/ksh **//[1] sets shell**
set -x **//[2]will this show the argument values before execution?**
l=$1 **//[3]$1,$2,$3 are the arguments with which this shell**
h=$2 **//is invoked.l= first argument h= second argument and**
k=$3 **//k=3rd argument.**
/export/home/someguy/daily_refresh/abc_mt_dt.ksh $l $h $k
**//[4] calling abc_mt_dt.ksh
// with arguments l h and k**
chmod 777 /export/home/someguy/daily_refresh/$k.txt
**// making $k.txt a read write n**
**//executable.This im sure im right**
while read line
do
echo $line |read a b c
**// [5] reads three values from keyboard and displays them as
//well as storing them in values a b and c**
DATA_START_DT=$a
**// [6] variables DATA_START_DT DATA_END_DT ID set to the three**
DATA_END_DT=$b **// values read from keyboard**
ID=$c
echo $DATA_START_DT **//[7] displaying the values read from keyboard**
echo $DATA_END_DT
echo $ID
rm -rf /export/home/someguy/daily_refresh/logs/abc_$DATA_END_DT.log
**//[8] rm -rf is to recursively remove files and folders ..
so what will this command do? will it remove all files and folders
inside /export/home/someguy/daily_refresh/logs/ ?**
bteq <<EOI > /export/home/someguy/daily_refresh/logs/abc_$DATA_END_DT.log 2>&1
**// [9] need explaination as to what this does.**
.run file = /export/home/someguy/logon_caracal.bteq **//[10]**
.MAXERROR 1; **//[11]**
DATABASE SOME_DATABASE; **//[12]**