The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to use arrays in c shell hgphsf Shell Programming and Scripting 6 12-14-2007 02:03 PM
arrays in shell script melanie_pfefer Shell Programming and Scripting 3 05-18-2007 08:36 AM
Bourne Shell and Arrays Unbeliever Shell Programming and Scripting 2 07-25-2005 10:48 AM
Shell arrays in oracle stored procedure superprogrammer Shell Programming and Scripting 6 06-09-2005 06:36 PM
shell: creating different arrays based on function argument nix21 Shell Programming and Scripting 5 03-20-2005 11:34 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-11-2007
domain's Avatar
domain domain is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
I need help with arrays in C Shell

Hi guys
could you please post links that explain how to use and manipulate arrays in c shell (.csh files) ? examples are useful too
  #2 (permalink)  
Old 12-11-2007
drl's Avatar
drl drl is online now Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 711
Hi.

See Csh for a lot of information about csh, including "lists".
Code:
#!/usr/bin/env tcsh

# @(#) s1       Demonstrate array-like csh features, "lists".

echo
echo "(Versions displayed with local utility version)"
sh -c "version >/dev/null 2>&1" && version tcsh
echo

set a = ( hello world )
echo " $a[2]"

exit 0
Producing:
Code:
% ./s1

(Versions displayed with local utility version)
tcsh 6.13.00

 world
... cheers, drl

_____
Standard advice: avoid csh for scripting, use Bourne-family shells.
  #3 (permalink)  
Old 12-13-2007
domain's Avatar
domain domain is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 5
thanks drl for the reply
if you have more links that explain arrays please provide it to me
  #4 (permalink)  
Old 12-13-2007
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
why don't you tap the "Holy Grail of Information"?

man csh

will print out to the very screen in front of you all the information there is about csh and all you need to know for your homework.

bakunin
  #5 (permalink)  
Old 11-18-2008
npatwardhan npatwardhan is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 135
i am using arrays in a loop. how do i assign values?

i have the following code which works in bash..

Code:
set i=0 
while ($i < 11)
master_array[i]=${ARRAY[i]}
i++
done
it gives me error at line 3: Variable syntax
  #6 (permalink)  
Old 11-19-2008
drl's Avatar
drl drl is online now Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 711
Hi, npatwardhan.

You are adding a question to a completed thread that is a year old.

To get more interest in your question, I suggest you start a new thread of your own.

In addition, it is not clear what you want, do you want an answer for the bash shell or the c shell?

Best wishes ... cheers, drl
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0