Oct 4, 2004 #1 jouell MIS Joined Nov 19, 2002 Messages 304 Location US Hi, Does ksh allow me to return "Sep" if my variable is September (I am not using the date command in the script) ? I.E. month=September echo $month{1-3} or something? Didnt find it in man for ksh. tks! -john
Hi, Does ksh allow me to return "Sep" if my variable is September (I am not using the date command in the script) ? I.E. month=September echo $month{1-3} or something? Didnt find it in man for ksh. tks! -john
Oct 4, 2004 2 #2 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR Something like this ? typeset -L3 y=$month;echo $y Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
Something like this ? typeset -L3 y=$month;echo $y Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Oct 4, 2004 #3 vgersh99 Programmer Joined Jul 27, 2000 Messages 2,146 Location US Code: #!/bin/ksh echo "${month%${month#???}}" vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
Code: #!/bin/ksh echo "${month%${month#???}}" vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Oct 4, 2004 #4 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR Yet another way: expr substr $month 1 3 Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
Yet another way: expr substr $month 1 3 Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Oct 4, 2004 Thread starter #5 jouell MIS Joined Nov 19, 2002 Messages 304 Location US Thanks for the fast responses!!! That is the ticket! -john Upvote 0 Downvote
Oct 8, 2004 #6 imayankee Technical User Joined Oct 6, 2004 Messages 3 Location US Using ksh93: # month=September # print $month September # print ${month:0:3} Sep Upvote 0 Downvote