![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| LANG=C not English? | dotancohen | Linux | 4 | 03-11-2008 12:40 AM |
| auto decode a value to different value | nhatch | Shell Programming and Scripting | 2 | 05-16-2007 09:01 AM |
| Decode email | mskarica | Shell Programming and Scripting | 6 | 03-17-2005 09:31 PM |
| gunzip and base64 decode a string | handak9 | High Level Programming | 2 | 10-23-2004 06:05 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Please decode in English
Hello: Can anyone please decode this script in English. I have also made some comments which I know.. The actual script does not have one comment also..
#! /bin/ksh . odbmsprd_env.ksh #setting the env.. echo $0 Started at : `date '+%d-%m-%Y %H:%M:%S'` # what's echo $0 curdt=`date '+%Y%m%d%H%M%S'` file=rpt # why file=rpt #what's $# ==3 -- I know we pass 3 parameters to the script and 3rd param is file name and 1st is startdate and 2nd is enddate. if (( $# == 3 )) then echo arguments: $1 $2 $3 sql @rcvdata_p.sql $1 $2 file=$3 fi # We are calling sql scripts to do some processing. sql @rcvstmt3_p.sql sql @rcvrep_p.sql # We are checking number of lines in the file pur_jur.csv lns=`cat pur_jur.csv|wc -l` # If we have lines in the file, then do processing if (( $lns > 0 )) then echo $lns records found in PURCHASE JOURNAL # Debug into english the next line sed 's/ //g' pur_jur.csv|sed 's/,//g'|sed 's/|/,/g' > pur_jur1.csv # I understand the rest of the program mv pur_jur1.csv pur_jur_"$file".csv ftp_to_q_pnet.ksh pur_jur_"$file".csv compress pur_jur_"$file".csv mv /home/odbms/prod/cg_batch/purchase_journal/pur_jur_"$file".csv.Z /dataload/odbms/dataout/pur_jur_"$file".$curdt.csv.Z else echo No records found for Purchase Journal rm pur_jur.csv fi echo $0 ended at : `date '+%d-%m-%Y %H:%M:%S'` |
| Forum Sponsor | ||
|
|
|
||||
|
$0 is the name of the script. Suppose I type a command like this:
somescript option filename You seem to know that $1 will be "option" and $2 will be "filename". You need to accept that $0 will be "somescript" as well. As for: file=rpt This creates a variable named file and sets it equal to "rpt". You can see references to $file in a line like: mv pur_jur1.csv pur_jur_"$file".csv That will become mv pur_jur1.csv pur_jur_rpt.csv |