Unix Shell - Re: KSH: Accessing individual words in a variable string (like

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > December 2007 > Re: KSH: Accessing individual words in a variable string (like





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: KSH: Accessing individual words in a variable string (like
Generic Usenet Account

2007-12-03, 7:25 pm

On Nov 29, 7:38 pm, use...@sta.samsung.com wrote:
> Kindly suggest the ksh equivalent of the following csh script snippet
>
> ##############################
> set presidents=(Washington Adams Jefferson Madison Monroe Qunicy-Adams
> Jackson)
>
> echo $presidents[1] $presidents[4-7]
> ##############################




The only thing that I can get to work is the following:

presidents[0]=Washington
presidents[1]=Adams
presidents[2]=Jefferson
presidents[3]=Madison
presidents[4]=Monroe
presidents[5]=Qunicy-Adams
presidents[6]=Jackson

echo ${presidents[0]} ${presidents[3]}
##### Could not find the KSH equivalent for echo
$presidents[4-7]

echo ${#presidents[*]}


Is there some way to print a range of array elements?

Thanks


[Courtesy: http://www.livefirelabs.com/unix_ti...03/11102003.htm

http://www.livefirelabs.com/unix_ti...03/11172003.htm]

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com