Sponsored Content
Full Discussion: Error in Unix Script
Top Forums Shell Programming and Scripting Error in Unix Script Post 302298697 by joyrules on Wednesday 18th of March 2009 10:37:37 AM
Old 03-18-2009
Agin Script Formatted

Code:
data=`ls -lt $1 |tr -t [' '] ['\t']|tr -s '\t'|cut -f3,5` 
count=0 
flag=1 
sum=0 
users_flag=1 
check=0 
declare -a users 
for a in $data 
do 
    if [ $users_flag -eq 1 ] 
    then 
        for ((i = 0; $i <= count; $i++)) 
        do 
            if [ $a = ${users[$count]} ] 
            then 
                flag=0 
                break 
            fi 
        done 
        if [ $flag  -eq 1 ] 
        then 
            users[$count]=$a 
            count=expr`$count + 1` 
            echo $a >> userdata 
        fi 
        users_flag=0 
    else 
        if [ $flag -eq 1 ] 
        then 
             
            for b in $data 
            do 
                if [ $check -eq 0 ] 
                then 
                    if [ $b = $a ] 
                    then  
                        check=1 
                    fi 
                else 
                    sum=`expr $sum + $b` 
                    check=0 
                fi  
            done 
        fi 
    fi 
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error while trying to fire a PL/SQL thro Unix Script

hi , I tried running a PL/SQL script through unix shell script. But am getting the following error. "Message file sp1<lang>.msb not found Error 6 initializing SQL*Plus " Kindly suggest. Regards, Samit (5 Replies)
Discussion started by: dharmesht
5 Replies

2. UNIX for Dummies Questions & Answers

forcefully throwing error : unix script

how can i make one script fail if some condition is not satisfied.i m writing if ..else logic in script.i need some standard command to do that ,, (1 Reply)
Discussion started by: dr46014
1 Replies

3. Shell Programming and Scripting

Syntax Error in Unix Shell Script

I am trying to run a unix script in my home directory.Snippet below echo "`date '+%Y%m%d_%H%M%S'` Getting ProductList.dat" if ( -f $DIR/ProductList.dat) then cp $DIR/ProductList.dat MigratedProductList.dat else echo "`date '+%Y%m%d_%H%M%S'`ProductList.dat does not exist; Processing... (4 Replies)
Discussion started by: Mary James
4 Replies

4. Shell Programming and Scripting

UNIX Error in Script

When i run a script in linux. It shows the following error. 'icsftpagent.sh: line 114: syntax error near unexpected token ` 'icsftpagent.sh: line 114: `Nicsftp() My Script is as follows: #!/bin/bash #### Copyright Notice: #### #### Copyright (c) 2007 Network Intelligence Corporation ... (1 Reply)
Discussion started by: sourabh.chhabra
1 Replies

5. Shell Programming and Scripting

Error in UNIX script

When i run a script in linux. It shows the following error. 'icsftpagent.sh: line 114: syntax error near unexpected token `'icsftpagent.sh: line 114: `Nicsftp() The script is as follows. #!/bin/bash #### Copyright Notice: #### #### Copyright (c) 2007 Network Intelligence Corporation ... (7 Replies)
Discussion started by: sourabh.chhabra
7 Replies

6. Shell Programming and Scripting

UNIX shell script error: not found

Hello All, I'm working on one Unix shell sript that will actually extract a column data from Oracle table using sqlplus and writes onto a file. I'm getting this error when executing the shell script: rpt.ksh: ^JScott: not found Below is the code in the shell script: `sqlplus -s... (1 Reply)
Discussion started by: venkat_reddy
1 Replies

7. Shell Programming and Scripting

Isql syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (1 Reply)
Discussion started by: Suresh
1 Replies

8. UNIX for Advanced & Expert Users

Isql and If Exist syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (7 Replies)
Discussion started by: Suresh
7 Replies

9. UNIX for Beginners Questions & Answers

UNIX script error message

Greeting!! I wrote the below script to e-mail me only file names in a specific directory when a file is delayed for some time in a that directory. I am getting unexpected eof error message. I don't want any email if the folder is blank.(if the condition is not met) I am not getting the email at... (4 Replies)
Discussion started by: Hope
4 Replies

10. UNIX for Beginners Questions & Answers

UNIX script error message

I have this UNIX script code with a query to export sql table in Oracle and export to csv file. The code gets the data correctly. However, when I run the script second time, I got the error message "not spooling currently" and shows the older data in csv file. When I delete the csv file and run... (5 Replies)
Discussion started by: Hope
5 Replies
CheckDigits::M10_008(3pm)				User Contributed Perl Documentation				 CheckDigits::M10_008(3pm)

NAME
CheckDigits::M10_008 - compute check digits for Sedol (GB) SYNOPSIS
use Algorithm::CheckDigits; $sedol = CheckDigits('sedol'); if ($sedol->is_valid('0123457')) { # do something } $cn = $sedol->complete('012345'); # $cn = '0123457' $cd = $sedol->checkdigit('0123457'); # $cd = '7' $bn = $sedol->basenumber('0123457'); # $bn = '012345' DESCRIPTION
ALGORITHM 1. Beginning left all numbers are weighted with 1,3,1,7,3,9 and 1 (checkdigit) 2. The sum of all products is computed. 3. The check digit is the difference of the sum from step 3 to the next multiple of 10. METHODS is_valid($number) Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above. Returns false otherwise, complete($number) The check digit for $number is computed and concatenated to the end of $number. Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces. basenumber($number) Returns the basenumber of $number if $number has a valid check digit. Return '' otherwise. checkdigit($number) Returns the checkdigit of $number if $number has a valid check digit. Return '' otherwise. EXPORT None by default. AUTHOR
Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de> SEE ALSO
perl, CheckDigits, www.pruefziffernberechnung.de. perl v5.10.0 2008-05-17 CheckDigits::M10_008(3pm)
All times are GMT -4. The time now is 10:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy