Sponsored Content
Top Forums Shell Programming and Scripting Converting date +%j into integer Post 302882961 by vbe on Friday 10th of January 2014 04:55:32 AM
Old 01-10-2014
a bug in bash??
Code:
n12:/home/vbe/wks/test/arithmetics $ bash
n12:/home/vbe/wks/test/arithmetics $ let A=$(date +%j)
n12:/home/vbe/wks/test/arithmetics $ echo $A
8
n12:/home/vbe/wks/test/arithmetics $ exit
exit
n12:/home/vbe/wks/test/arithmetics $ echo $0
/usr/dt/bin/dtksh
n12:/home/vbe/wks/test/arithmetics $ let A=$(date +%j)
n12:/home/vbe/wks/test/arithmetics $ echo $A              
10

Did my test on AIX7.1 after seeing on old HP it works (only ksh...)

So change your first line to sh or ksh...
This User Gave Thanks to vbe For This Post:
 

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

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

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 a date to friday date and finding Min/Max date

Dear all, I have 2 questions. I have a file with many rows which has date of the format YYYYMMDD. 1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too. 2. After converting the date to... (10 Replies)
Discussion started by: 2001.arun
10 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
APD_BREAKPOINT(3)							 1							 APD_BREAKPOINT(3)

apd_breakpoint - Stops the interpreter and waits on a CR from the socket

SYNOPSIS
bool apd_breakpoint (int $debug_level) DESCRIPTION
This can be used to stop the running of your script, and await responses on the connected socket. To step the program, just send enter (a blank line), or enter a php command to be executed. PARAMETERS
o $ debug_level -An integer which is formed by adding together the XXX_TRACE constants.It is not recommended to use MEMORY_TRACE. It is very slow and does not appear to be accurate. ASSIGNMENT_TRACE is not implemented yet.To turn on all functional traces (TIM- ING, FUNCTIONS, ARGS SUMMARY (like strace -c)) use the value 99 RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Typical session using tcplisten bash#tcplisten localhost 7777 APD - Advanced PHP Debugger Trace File --------------------------------------------------------------------------- Process Pid (6118) Trace Begun at Sun Mar 10 23:13:12 2002 --------------------------------------------------------------------------- ( 0.000000): apd_set_session_trace called at /home/alan/Projects/project2/test. php:5 ( 0.074824): apd_set_session_trace_socket() at /home/alan/Projects/project2/tes t.php:5 returned. Elapsed (0.074824) ( 0.074918): apd_breakpoint() /home/alan/Projects/project2/test.php:7 ++ argv[0] $(??) = 9 apd_breakpoint() at /home/alan/Projects/project2/test.php:7 returned. Elapsed ( -2089521468.1073275368) > statement: /home/alan/Projects/project2/test.php:8 > statement: /home/alan/Projects/project2/test.php:8 > statement: /home/alan/Projects/project2/test.php:10 >apd_echo($i); EXEC: apd_echo($i); 0 >apd_echo(serialize(apd_get_active_symbols())); EXEC: apd_echo(serialize(apd_get_active_symbols())); a:47:{i:0;s:4:"PWD";i:1;s:10:"COLORFGBG";i:2;s:11:"XAUTHORITY";i:3;s:14:" COLORTERM_BCE";i:4;s:9:"WINDOWID";i:5;s:14:"ETERM_VERSION";i:6;s:16:"SE SSION_MANAGER";i:7;s:4:"PS1";i:8;s:11:"GDMSESSION";i:9;s:5:"USER";i:10;s:5:" MAIL";i:11;s:7:"OLDPWD";i:12;s:5:"LANG";i:13;s:10:"COLORTERM";i:14;s:8:"DISP LAY";i:15;s:8:"LOGNAME";i:16;s:6:" >apd_echo(system('ls /home/mydir')); >apd_continue(0); PHP Documentation Group APD_BREAKPOINT(3)
All times are GMT -4. The time now is 01:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy