The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ls - maximum number of files karnan UNIX for Dummies Questions & Answers 6 10-15-2008 06:56 PM
maximum number of arguments matrixmadhan UNIX for Dummies Questions & Answers 9 10-15-2008 06:03 PM
handling maximum number characters in an input file chrysSty UNIX and Linux Applications 1 05-12-2008 11:19 AM
help on ksh and sql..getting error as is too long. maximum size is 240 characters." pooga17 UNIX for Advanced & Expert Users 1 02-06-2008 05:56 AM
Line with maximum no . of characters mohapatra Shell Programming and Scripting 4 10-12-2006 02:31 AM

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 07-23-2004
pcshan pcshan is offline
Registered User
  
 

Join Date: Jul 2004
Location: India
Posts: 4
Question What is the Maximum number of characters that i can store in a variable?

Hi,

Can any one tell me, what is the maximum number of characters that can be stored in a variable?

Thanks in Advance,

Shan
  #2 (permalink)  
Old 07-23-2004
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Which language?

Which OS?

Which architecture?
  #3 (permalink)  
Old 07-23-2004
pcshan pcshan is offline
Registered User
  
 

Join Date: Jul 2004
Location: India
Posts: 4
sorry, here are the details

Language : Unix (shell script)
OS : UNIX System V Release 4.0 Version 3.0
  #4 (permalink)  
Old 07-23-2004
photon's Avatar
photon photon is offline
Registered User
  
 

Join Date: Jul 2002
Posts: 162
By character you mean ASCII character?

8 bits or byte can hold 256 possible values (2^8=256)

C char is 1 byte
C undigned char 1 byte
so then...
C short int 2 bytes
C unsigned short int 2 bytes
C (long) int 4 bytes
C float 4 bytes
C double 8 bytes
In Java byte

By character you mean UCS-2?
16 bits
C short int
C int (sometimes)
Java char and Java short int

By character you mean UCS-4
32 bits
C int (usual)
C long int
Java int

64 bits longword or quadword
C long int (on 64 bit machine)
Java long int

Sometimes it depends on your machine

To allocate space to hold 14 int's

int *ip = malloc(14 * sizeof(int));

whould make room for 14 integers depending on your machine.
  #5 (permalink)  
Old 07-23-2004
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
I know that some commands on some flavours of Unix running on certain architectures may have restrictions (1024 or 2048 chars), but these are imposed by certain commands such as grep and others under those OSes. Most modern *nix shells are fairly flexible, and you can write to arrays, use xargs, and perform other chicanery to get around any limits you encounter. The Korn shell has a limit of 1024 array elements. I'm not aware of any other limits.

Why would you want to store a huge amount of data in a shell variable anyway??

Cheers
ZB
  #6 (permalink)  
Old 07-25-2004
pcshan pcshan is offline
Registered User
  
 

Join Date: Jul 2004
Location: India
Posts: 4
Reason why i need large amount of data on a variable

Thanks for all your valuable suggestions.

I store a list of mail ids in a .lis file and from a shell script i retrieve all the mail ids and put it in a variable by using blankspace as delimiter.

And i export that variable. So, there is another program which makes use of that exported variable to send the e-mail to e-mail addresses stored in that variable.

When i tried with multiple entires, it allows only 512 characters.

Please suggest me if there is any work around.

Thanks and Regards

Shanmugam
  #7 (permalink)  
Old 08-09-2004
beilstwh beilstwh is offline
Registered User
  
 

Join Date: Jul 2004
Location: New York State
Posts: 65
How many addresses, if it is less then 1024 you can use a variable array in the Korn shell. You could also have unlimited length on a variable if you use PERL, which is loaded on most unix boxes.
Closed Thread

Bookmarks

Tags
sendmail

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 08:23 PM.


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