Chose option Utility


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Chose option Utility
# 8  
Old 06-02-2008
Thank you so much for the clear explanation. You are a very nice person to explain the things to others. Once again thank u.
# 9  
Old 06-05-2008
No problem. Shell scripting is weird. I've been doing it since 1983 and it's still weird. Happy to help.

Perl is much better, but still weird.

I'm going to start learning Python. I think that will be a much better scripting language.
-mschwage

P.S. Definition of weird: Writing a 600 line shell script and forgetting to match the double-quotes in a string somewhere around line 200. Tracking down that error is part of the definition of 'pain'. Shell scripting is essential on UNIX, but oh boy... Smilie
# 10  
Old 06-06-2008
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Unrecognized option: sparc-sun-Solaris2.10/bin/as: unrecognized option `-m32'

Hi, I installed some packages required by an app built with python. But when I try python setup.py install, I get the following error: /opt/csw/lib/gcc/sparc-sun-solaris2.10/5.2.0/../../../../sparc-sun-solaris2.10/bin/as: unrecognized option `-m32' Could anyone tell me what's wrong... (4 Replies)
Discussion started by: Kimkun
4 Replies

2. Shell Programming and Scripting

Chose list of sub directories in a bash script file

Hi, I have a command in my bash script, searchDirectoryName.sh: DIR_NAME=$(find . -type d) echo "${DIR_NAME}" . ./Dir1 ./Dir1/1.0.2.1 ./Dir2 ./Dir2/1.1 ./Dir3 ./Dir3/2.2.1 How can I select only following directory names with second subdirectoies and without first ./ in the... (3 Replies)
Discussion started by: hce
3 Replies

3. Shell Programming and Scripting

How to chose certain character in a word?

Hi Expert, I would like to know on how to export only the first 6 character of below 0050569868B7 ABCDEFGHTY to 005056 ABCDEF Thank you. Reggy (7 Replies)
Discussion started by: regmaster
7 Replies

4. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

5. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

6. Shell Programming and Scripting

utility

hi experts, Can you please help me out in removing delimiters with in double quotes from a CSV file. input: ===== a,"bnn,",dgd, "sagfh,dj",ad output ===== a,"bnn",dgd, "sagfhdj",ad there are so mnay fileds in a row and there are millions of rows. Thanks in an advance.... (6 Replies)
Discussion started by: subhendu81
6 Replies

7. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

8. Shell Programming and Scripting

Gunzip utility

Hi All, Is there any utility or command to read a .gz file without GUNZIPing it? Why I need this because of the huge size of the file. I am looking for something like zcat. Any help is aprreciated. Thanks in Advance.. Regards, rin... (1 Reply)
Discussion started by: rinku11
1 Replies

9. Programming

MAKE utility

I wrote a makefile, every thing is working fine, But One of the C header files which is created by me is kept in a different folder other than the current directory, I have given this PATH to VPATH Variable Example :- VPATH = /home/user1/projects/victor.h It gives an error as : file... (4 Replies)
Discussion started by: victorvvk
4 Replies

10. UNIX for Dummies Questions & Answers

What utility do I use for this?

I want to pull out the 3rd column of information and stick in a file. What is the Utility I use to do this? (8 Replies)
Discussion started by: James
8 Replies
Login or Register to Ask a Question