Sponsored Content
Full Discussion: Converting integer to String
Top Forums Shell Programming and Scripting Converting integer to String Post 302202733 by ROOZ on Thursday 5th of June 2008 01:38:45 PM
Old 06-05-2008
guys i just found out how to do it
i only need to use {} brackets around i
for i in 1 2 3

variable ${i}=....

done
 

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. UNIX for Dummies Questions & Answers

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 (2 Replies)
Discussion started by: neeto
2 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

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

6. 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

7. 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

8. 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

9. 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

10. 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
Perl::Critic::Policy::Variables::ProhibitEvilVariables(3User Contributed Perl DocumentaPerl::Critic::Policy::Variables::ProhibitEvilVariables(3pm)

NAME
Perl::Critic::Policy::Variables::ProhibitEvilVariables - Ban variables that aren't blessed by your shop. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Use this policy if you wish to prohibit the use of specific variables. These may be global variables warned against in "perlvar", or just variables whose names you do not like. CONFIGURATION
The set of prohibited variables is configurable via the "variables" and "variables_file" options. The value of "variables" should be a string of space-delimited, fully qualified variable names and/or regular expressions. An example of prohibiting two specific variables in a .perlcriticrc file: [Variables::ProhibitEvilVariables] variables = $[ $^S $SIG{__DIE__} If you prohibit an array or hash (e.g. @INC), use of elements of the array or hash will be prohibited as well. If you specify a subscripted variable (e.g. $SIG{__DIE__}), only the literal subscript specified will be detected. The above <.perlcritic> file, for example, will cause "perlcritic(1)" to detect "$SIG{__DIE__} = &foo", but not my $foo = '__DIE__'; $SIG{$foo} = &foo; Regular expressions are identified by values beginning and ending with slashes. Any variable with a name that matches "m/pattern/sm" will be forbidden. For example: [Variables::ProhibitEvilVariables] variables = /acme/ would cause all variables that match "m/acme/" to be forbidden. If you want a case-blind check, you can use (?i: ... ). For example [Variables::ProhibitEvilVariables] variables = /(?i:acme)/ forbids variables that match "m/acme/smi". In addition, you can override the default message ("Prohibited variable "variable" used") with your own, in order to give suggestions for alternative action. To do so, put your message in curly braces after the variable name or regular expression. Like this: [Variables::ProhibitEvilVariables] variables = $[ {Found use of $[. Program to base index 0 instead} If your message contains curly braces, you can enclose it in parentheses, angle brackets, or square brackets instead. Similarly, the "variables_file" option gives the name of a file containing specifications for prohibited variables. Only one variable specification is allowed per line and comments start with an octothorp and run to end of line; no curly braces are necessary for delimiting messages: $[ # Prohibit the "$[" variable and use the default message. # Prohibit the "$^S" variable and give a replacement message. $^S Having to think about $^S in exception handlers is just wrong # Use a regular expression. /acme/ No coyotes allowed. By default, there are no prohibited variables, although I can think of a few that should be. See "perldoc perlvar" for a few suggestions. RESTRICTIONS
Variables of the form "${^foo}" are not recognized by PPI as of version 1.206. When PPI recognizes these, this policy will Just Work for them too. Only direct references to prohibited variables and literal subscripts will be recognized. For example, if you prohibit $[, the first line in my $foo = $[; $$foo = 1; will be flagged as a violation, but not the second, even though the second, in fact, assigns to $[. Similarly, if you prohibit $SIG{__DIE__}, this policy will not recognize my $foo = '__DIE__'; $SIG{$foo} = sub {warn 'I cannot die!'}; as an assignment to $SIG{__DIE__}. NOTES
This policy leans heavily on Perl::Critic::Policy::Modules::ProhibitEvilModules by Jeffrey Ryan Thalhammer. AUTHOR
Thomas R. Wyant, III wyant at cpan dot org COPYRIGHT
Copyright (c) 2009-2011 Thomas R. Wyant, III This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.14.2 2012-06-07 Perl::Critic::Policy::Variables::ProhibitEvilVariables(3pm)
All times are GMT -4. The time now is 02:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy