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 and shell scripting languages 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 05:09 AM
When running if condition, getting the following error sunitachoudhury Shell Programming and Scripting 1 04-06-2008 03:31 AM
Error while running rsh commands !!! csaha Shell Programming and Scripting 3 11-08-2006 01:47 AM
Error in running on AIX 5.2 SMISS AIX 0 06-24-2004 12:06 PM
Error while running a script HarryTellegen UNIX for Dummies Questions & Answers 5 02-05-2002 02:58 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 06-06-2008
balamv balamv is offline
Registered User
  
 

Join Date: May 2008
Posts: 24
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
  #2 (permalink)  
Old 06-06-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

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

Proceed here:

Chose option Utility

Thread closed.
Closed Thread

Bookmarks

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 12:12 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