![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems . |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Global variable declaration in shell scripting | susilgandhi | Shell Programming and Scripting | 1 | 02-06-2008 12:59 AM |
| Can give the input to prompt using shell script | Vaibhav Agarwal | Shell Programming and Scripting | 2 | 11-01-2007 03:26 AM |
| Array Declaration and For Loop | 33junaid | Shell Programming and Scripting | 4 | 09-15-2007 04:16 PM |
| Size of an array in sh shell script | trivektor | Shell Programming and Scripting | 1 | 09-28-2006 11:01 PM |
| how to give a variable to a command in shell script... | santy | Shell Programming and Scripting | 6 | 08-17-2006 11:53 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
i cannot give array declaration in shell script
Dear all,
i m unable to give array decalartion in solaris Operating system shell script and script was so.sh declare -a bull[90] for i in 1 2 3 4 5 6 7 8 9 do bull[$i]=$i echo "${bull[$i]}" done it is throwing an error called so.sh: declare: not found so.sh: bull[1]=1: not found so.sh: bad substitution Sir if u cud help ragrding this issue |
|
|||||
|
Actually "declare -a" is supported in the bash shell.
If the bash shell is available on your system, then the following should work (you may need to change "/usr/local/bin/bash" to point to wherever bash is installed on your system) Code:
#!/usr/local/bin/bash
declare -a bull
for i in 1 2 3 4 5 6 7 8 9
do
bull[$i]=$i
echo "${bull[$i]}"
done
Code:
for (( i=1; i < 10; i++ ))
do
bull[$i]=$i
echo "${bull[$i]}"
done
|
|
||||
|
Cannot create and declare an array and substitute the values in bash shell
Sir i m unable to do .. above mentioned in a script ..
It shooting same old error. ara.sh: declare: not found ara.sh: syntax error at line 3: `(' unexpected ara.sh is declare -a bull[10] for (( i=1; i < 10; i++ )) do bull[$i]=$i echo "${bull[$i]}" done |
![]() |
| Bookmarks |
| Tags |
| solaris |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|