Size of an array in sh shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Size of an array in sh shell script
# 1  
Old 09-28-2006
Size of an array in sh shell script

Is there a way to find out the size of an array in sh shell script? Thanks.
# 2  
Old 09-29-2006
Code:
echo ${#arr}

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Array size in C shell scripting

Hi, I would like to know how to define the size of the array in c shell scripting. (15 Replies)
Discussion started by: gopishrine
15 Replies

2. Shell Programming and Scripting

Pass C shell array to another C shell script(csh) and shell(sh)

Dear Friends, Please help me on this my script name is send.csh In this i have written the statement like this set args = ( city state country price ) I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell or how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies

3. Shell Programming and Scripting

Need Shell Script for Array

Hi all, I have an input file like below (a comma seperated file) 345,12,10 400,11,8 328,1,3 I need to get the output as below ... record 345 sum is 12 record 400 sum is 10 record 328 sum is 1 record 345 count is 10 record 400 count is 8 record 328 count... (15 Replies)
Discussion started by: hemanthsaikumar
15 Replies

4. Shell Programming and Scripting

Array in shell script

Hi, check=("/usr/local/bin/chk_nag | awk -F":" '{print $1}'" "/usr/local/bin/chk_kas | awk -F":" '{print $1}'" "/usr/local/bin/chk_was | awk -F":" '{print $1}'" ) for i in "${check}"; do echo $i; done when I run this. It says Syntax error: "(" unexpected Please advise. (5 Replies)
Discussion started by: ashokvpp
5 Replies

5. Shell Programming and Scripting

shell script for getting the file size

Hi can some one please help me how i can get the output i require: My text file "sample.txt" contains the text like below Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_fedora-lv_root 15G 2.6G 12G 19% /hari Filesystem Size ... (3 Replies)
Discussion started by: harimhkr
3 Replies

6. Shell Programming and Scripting

Comparing two array in shell script

In shell script i have two variables with value debit_sal="DOG,HIU,JIU,GYT,PPI,KIU,HUY........." debit_req='HIU, JIU, HUY, GTR, KOI, ............" i stored this two in two array arr=$(echo $debit_sal| tr "," "\n"); arr1=$(echo $debit_req| tr ", " "\n"); #(note second arry has comma with... (5 Replies)
Discussion started by: greenworld123
5 Replies

7. Shell Programming and Scripting

Array in Ksh Shell script

hi team, i have a file, which contains only variable and its value param.ksh --------- export A=123 export B=345 export C=567 export D=OPLI export E=OL89PO From shell script, i am invoking this file and use the value of this variable. Now there are 5 variable in above file. Before i... (1 Reply)
Discussion started by: ace_friends22
1 Replies

8. Shell Programming and Scripting

Array declaration in Shell script

this is my code declare -a USERCERT declare -a CACERT declare -a KEYSRC this is the error + declare -a USERCERT ./clone.sh: 1: declare: not found + declare -a CACERT ./clone.sh: 1: declare: not found + declare -a KEYSRC ./clone.sh: 1: declare: not found (11 Replies)
Discussion started by: xerox
11 Replies

9. Shell Programming and Scripting

IF condition against a ARRAY in shell script

Hi, I want to check a particular string inserted by User to be checked against the values i already have in a ARRAY string using IF condition. Is this possible? if yes how to do that. example : i have a,b,c,d,e,f values in a array called values i asked user to enter a value: user entered... (2 Replies)
Discussion started by: kukretiabhi13
2 Replies

10. Shell Programming and Scripting

Get file size in c shell script?

Hi, I want to use an 'if statement' that will check if a certian file is greater in size than a certain value given by the user, but cannot get it to work. Do you have any ideas how this can be done? Your help is appreciated! (6 Replies)
Discussion started by: Dado
6 Replies
Login or Register to Ask a Question