The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
error in running shell script in cron sari Shell Programming and Scripting 3 04-16-2008 01:09 AM
When running if condition, getting the following error sunitachoudhury Shell Programming and Scripting 1 04-05-2008 11:31 PM
Error while running rsh commands !!! csaha Shell Programming and Scripting 3 11-07-2006 09:47 PM
Error in running on AIX 5.2 SMISS AIX 0 06-24-2004 08:06 AM
Error while running a script HarryTellegen UNIX for Dummies Questions & Answers 5 02-04-2002 10:58 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-05-2008
Registered User
 

Join Date: May 2008
Posts: 10
Error while running your script -- Balamv

When I run this, I am getting the below error. Why? Pls help me

#!/bin/ksh
echo Hello World
dirs="not_using_0"
for entry in *; do
[ -d "$entry" ] && dirs="$dirs $entry"
done
dirarray=($dirs)
index=1
while [ -n "${dirarray[$index]}" ] ; do
echo "${index}: ${dirarray[$index]}"
index=`expr $index + 1`
done
while [ -z "$ans" ] ; do
echo -n "Choose one -> "
read ans
[ -z "${dirarray[$ans]}" ] && echo "Invalid response; try again."
done
echo "Result is ${dirarray[$ans]}"




Hello World
arrayshell.sh: syntax error at line 7: `dirarray=' unexpected
Forum Sponsor
  #2 (permalink)  
Old 06-06-2008
Moderator
 

Join Date: Feb 2007
Posts: 1,539
No duplicate or cross-posting, read the rules.

Proceed here:

Chose option Utility

Thread closed.
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:48 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0