Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Converting a String variable into Integer Post 302198309 by neeto on Thursday 22nd of May 2008 03:10:31 PM
Old 05-22-2008
Converting a String variable into Integer

Hi,
I am passing a variable to a unix function.
However when I try to assign the value to another variable like
typeset -i I_CACHE_VAL=$2
Is this because of String to Integer conversion?

I get an error.
Please help me with thsi.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command for converting string to integer

Hi ... I am trying to calculate the time needed for a command to execute.. but the resulting value is getting as string.. so i am not able to use "expr " command.. please help me to convert the value to integer so that i can proceed with my script.. Regards esham (1 Reply)
Discussion started by: esham
1 Replies

2. Shell Programming and Scripting

Converting a decimal into integer

Hi all, I'm trying to convert a decimal number into an integer number; I'm doing this: n=`echo |awk '{ print "'"$mem"'"*10}'` where the variable mem is equal to 3.7 I'd like to obtain 37, but the expression above gives me 30. Help please!!!! thx a lot (4 Replies)
Discussion started by: idro
4 Replies

3. Shell Programming and Scripting

Converting integer to String

Hi everyone, I would like to know how to convert an integer to a string. for instance if i=1 i would like to creat a variable called constant1. i want to do this in a for loop so for each value of i, i create a new variable such as constant2, constant3,... and so on. for i in 1 2 3 do ... (1 Reply)
Discussion started by: ROOZ
1 Replies

4. Shell Programming and Scripting

Converting decimal to integer

The shell mentioned below will show a warning if the page takes more than 6 seconds to load. The problem is that myduration variable is not an integer. How do I convert it to integer? myduration=$(curl http://192.168.50.1/mantisbt/view.php?id=1 -w %{time_total}) > /dev/null ; ] && echo... (3 Replies)
Discussion started by: shantanuo
3 Replies

5. Shell Programming and Scripting

Converting Month into Integer

okay so i run an openssl command to get the date of an expired script. Doing so gives me this: enddate=Jun 26 23:59:59 2012 GMT Then i cut everything out and just leave the month which is "Jun" Now the next part of my script is to tell the user if the the certificate is expired or not... (6 Replies)
Discussion started by: shade917
6 Replies

6. Shell Programming and Scripting

Converting date +%j into integer

Dear community, i got a problem to get "date +%j" as the right value. Today is the 10th day of the year. #./script.sh 2 #!/bin/bash/ Var1=$(date +%j) Var2=$1 let result=$Var1+$Var2 echo $Var1 plus $Var2 equals $result The output of the script is: 010 plus 2 equals 10... (9 Replies)
Discussion started by: OskarHF
9 Replies

7. Shell Programming and Scripting

Converting string to integer

I have a function that is supposed to check for user processes and wait for 0 count before exiting the function. I am sure I have more than one issue in my code, but the stumbling block right now is that I am trying to convert the value of my variable from a string to integer. process_count... (10 Replies)
Discussion started by: MIA651
10 Replies

8. Shell Programming and Scripting

Converting String To Integer/Float (weird case)

Hi guys, I'm new here. I have a problem at work. One of our scripts was eventually having a bug and only detected recently. Here's the issue and background: Bash Script which calls AWK script Awk script returns a string as per below (example):var1='00000-123'So, when we convert it, the... (18 Replies)
Discussion started by: sekfarok
18 Replies

9. Shell Programming and Scripting

Converting time format as Integer to seconds

Hello, How can we convert date like format 20181004171050 in seconds ? I can able to convert till date but failing for HHMMSS. date -d "20181004" "+%s" output as 1538596800 . But when i add hhmmss it is failing date -d "20181004172000" "+%s" result Invalid date Kindly guide. Regards (16 Replies)
Discussion started by: sadique.manzar
16 Replies

10. UNIX for Beginners Questions & Answers

Replace integer string in a variable based on month?

Hi Folks - Linux Version = Linux 2.6.39-400.128.17.el5uek x86_64 I have a process that determines the start and end load periods for an Oracle data load process. The variables used are as follows follows: They are populated like such: However, the load requires the month to be the... (11 Replies)
Discussion started by: SIMMS7400
11 Replies
Mail::SpamAssassin::BayesStore::MySQL(3)		User Contributed Perl Documentation		  Mail::SpamAssassin::BayesStore::MySQL(3)

NAME
Mail::SpamAssassin::BayesStore::MySQL - MySQL Specific Bayesian Storage Module Implementation SYNOPSIS
DESCRIPTION
This module implements a MySQL specific based bayesian storage module. It requires that you are running at least version 4.1 of MySQL, if you are running a version of MySQL < 4.1 then several aspects of this module will fail and possibly corrupt your bayes database data. In addition, this module will support rollback on error, if you are using the InnoDB database table type in MySQL. For more information please review the instructions in sql/README.bayes. METHODS
token_expiration public instance (Integer, Integer, Integer, Integer) token_expiration(\% $opts, Integer $newdelta, @ @vars) Description: This method performs the database specific expiration of tokens based on the passed in $newdelta and @vars. seen_put public (Boolean) seen_put (string $msgid, char $flag) Description: This method records $msgid as the type given by $flag. $flag is one of two values 's' for spam and 'h' for ham. seen_delete public instance (Boolean) seen_delete (string $msgid) Description: This method removes $msgid from the database. set_last_expire public instance (Boolean) set_last_expire (Integer $time) Description: This method sets the last expire time. set_running_expire_tok public instance (String $time) set_running_expire_tok () Description: This method sets the time that an expire starts running. remove_running_expire_tok public instance (Boolean) remove_running_expire_tok () Description: This method removes the row in the database that indicates that and expire is currently running. nspam_nham_change public instance (Boolean) nspam_nham_change (Integer $num_spam, Integer $num_ham) Description: This method updates the number of spam and the number of ham in the database. tok_touch public instance (Boolean) tok_touch (String $token, String $atime) Description: This method updates the given tokens ($token) atime. The assumption is that the token already exists in the database. tok_touch_all public instance (Boolean) tok_touch (@ $tokens String $atime) Description: This method does a mass update of the given list of tokens $tokens, if the existing token atime is < $atime. The assumption is that the tokens already exist in the database. We should never be touching more than N_SIGNIFICANT_TOKENS, so we can make some assumptions about how to handle the data (ie no need to batch like we do in tok_get_all) cleanup public instance (Boolean) cleanup () Description: This method peroms any cleanup necessary before moving onto the next operation. clear_database public instance (Boolean) clear_database () Description: This method deletes all records for a particular user. Callers should be aware that any errors returned by this method could causes the database to be inconsistent for the given user. Private Methods _connect_db private instance (Boolean) _connect_db () Description: This method connects to the SQL database. _initialize_db private instance (Boolean) _initialize_db () Description: This method will check to see if a user has had their bayes variables initialized. If not then it will perform this initialization. _put_token private instance (Boolean) _put_token (string $token, integer $spam_count, integer $ham_count, string $atime) Description: This method performs the work of either inserting or updating a token in the database. _put_tokens private instance (Boolean) _put_tokens (\% $tokens, integer $spam_count, integer $ham_count, string $atime) Description: This method performs the work of either inserting or updating tokens in the database. perl v5.12.1 2010-03-16 Mail::SpamAssassin::BayesStore::MySQL(3)
All times are GMT -4. The time now is 09:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy