![]() |
|
|
|
|
|||||||
| 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 |
| set Working day in ksh | Rafael.Buria | Shell Programming and Scripting | 1 | 10-09-2007 01:42 AM |
| FTP is not working. | ronald_brayan | Security | 10 | 04-04-2007 05:23 AM |
| ^P Not working on AIX. | akbar | AIX | 0 | 02-24-2007 03:52 PM |
| sed not working | baanprog | UNIX for Advanced & Expert Users | 5 | 09-18-2006 05:11 AM |
| why is this not working? | matt2kjones | UNIX for Dummies Questions & Answers | 2 | 07-09-2002 12:58 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Not working
Hi,
I have a file whose first line has some name followed by the timestamp and the sequence number. The last 3 digits of that line is seq number. If I get seq num other than 001, 004, 007 then I should generate an error saying, incorrect seq number else success. I am trying to run the following script but it is not giving me the exact result. It is working if I give -eq but with -ne it is not working. Can anyone help me out plz? sys_nam and timestamp I want for other purpose. Script : #!/bin/ksh eval $(awk 'NR==1 { printf "sys_nam=\"%s\"\n", substr($0,1,length-17) ## system_name printf "header_tstamp=\"%s\"\n", substr($0,length-16, 14) ## timestamp printf "in_seq_num=\"%s\"\n", substr($0, length-2) ## seq_num }' $1) if [[ $in_seq_num -ne "001" || $in_seq_num -ne "004" || $in_seq_num -ne "007" ]]; then notice_val="103" notice_desc="Seq number not as exptected" else notice_val="000" notice_desc="Success" fi echo "$in_seq_num" echo "$notice_val" echo "$notice_desc" |
| Forum Sponsor | ||
|
|
|
||||
|
Code:
if [[ $in_seq_num != "001" && $in_seq_num != "004" && $in_seq_num != "007" ]]; then notice_val="103" notice_desc="Seq number not as exptected" else notice_val="000" notice_desc="Success" fi Code:
if [[ $in_seq_num != @(001|004|007) ]]; then notice_val="103" notice_desc="Seq number not as exptected" else notice_val="000" notice_desc="Success" fi Jean-Pierre. |
|
||||
|
Quote:
Quote:
Quote:
|
||||
| Google UNIX.COM |