Hi All,
Thanks for so many suggestions.
Removing echo, does not work as it still gives syntax error.
Removing the leading zero also does not work. This gives an error as *60 not found. Since * is used as wild card.
I am using ksh, so I guess date -d won't work in ksh.
If i use the printf command, the date is not calculated. The error is thrown as
The output is like below.
1-Mar-10 03:56:51
START_TIME=()T
END_TIME=()T
()T-()T: syntax error
I tried using it this way.
Its still not working. Is there some other way to use printf command in unix?
---------- Post updated 1st Mar 2010 at 12:09 AM ---------- Previous update was 28th Feb 2010 at 11:42 PM ----------
I think the version is ksh88. I tried to print the SECONDS variable and its an integer value. So it should be a ksh88 rt?
---------- Post updated at 12:16 AM ---------- Previous update was at 12:09 AM ----------
Hi All,
Its working now!!
I am using the same original code and just modified the export command. Yes, removing echo does help.
substr is a test ksh88/ksh93.
date is not builtin command, it's in command in your system. -d option is in gnu date, not ex. in bsd date.
printf is builtin command in ksh93. So man ksh93 include documentation to use printf.
You don't need export in your code. Local variables is enough. Environment variables (export variable) are needed if you call subprocess and subprocess need those variables value also.
If you like to use ksh93, check download. Maybe your system is still supported.
Hi,
I have used expr command to increment the date.
for e.g.,
case 1 :
echo $(date -d $(echo `expr 20010101 + 1`))
it returns
Tue Jan 2 00:00:00 IST 2001
case 2:
echo $(date -d $(echo `expr 20010101 - 1`))
it returns
date: invalid date `20010100'
please suggest me, how to... (3 Replies)
I'm trying to check if a variable'd string is only one character and use that in an if statement the only way I could find is:
$expr "${var}" : . # expr STRING : regrep
where the "." is the grep wildcard for any single character.
Whats wrong with my code here and is there a... (3 Replies)
Hi guys,
For some reason the terminal on my mac does not let me run string manipulations commands using the expr command. I'm not sure how to fix this so I'm requesting a "work-around" to using the expr command...
This is the string I'm working with:
"neo_opls01_1.log"
And I'm trying to... (9 Replies)
Hi
Can anyone explain me the usage of this command and the arguments used here and what will be the expected output :
v_num=`expr nav_d_20100204_1759 : '*\(*\)'`
what will be the value returned in v_num.
Thanks in Advance!!!
Regards
Naveen Purbia (3 Replies)
:)
hi Unix gurus,
Pls consider the following piece of code
str='hello'
length=echo $str|wc -c
echo $length
y= ` expr \( 80 - $length \) `
echo $y
:confused:
The last echo stmt is displaying 0 as the result.
If i put direct value like 6 instead of $length in i 3rd stmt it is giving... (8 Replies)
hi guys....
i hava a command expr... where i m adding a value in a loop
like
Tc=`expr $Tc\+ $l`
where
Tc is declred as a variable and every time l contains a new vaue
if
Tc =0 initially
and l =2
Tc should be equal to 0+ 2
and then
l = 4
Tc = 2+4
and dispaly as 6
but after... (5 Replies)
Hi All,
I have created 85 users on Linux server.
I use bsh shell for all users.But after any user get logged in on unix,he/she is not able to access the expr command.So anyone can tell me that if i have to include some files to access expr command.Because when i write-> expr 6+2 on $ prompt i'll... (1 Reply)
Hi All,
I might be making a silly mistake but I need ur help.
I have initialized various variables:
cur_month=`date +%m`
cur_year=`date +%y`
last_year=`expr $cur_year \- 1`
It works fine for cur_month & cur_year....but has problems with last_year.
FOR LAST YEAR IT GIVES A FOLLOWING... (2 Replies)
I am looking for the correct syntax on the expr command in UNIX. I have a script that I am building at the moment. the script is creating file1 that is an actual .sql file that is going inside the oracle database to get some information in there. It take that information, puts it inside another... (2 Replies)