bourne shell script error on line containing declare...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting bourne shell script error on line containing declare...
# 1  
Old 09-06-2011
bourne shell script error on line containing declare...

Hi,

Get the following error when running a shell script with following statement.

Syntax error
at line 150 : `(' is not expected

150: declare -a VPO_SEV=(Normal Warning Minor Major Critical)

it runs fine using bash, so I guess the script should be using bash but is there a way to write the declare above using bourne shell? or am I forced to to use bash?
what options would I have if I didn't have bash on the system trying to run the script.

Thanks in advance.

Wilson.
# 2  
Old 09-07-2011
Yes, you are forced to use bash to run your script. If your system do not have bash, try to find ksh93. You need to do some changes anyway but it's more simpler to convert bash script to ksh scrpt than to bourne shell.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bourne Shell - Dynamic Variable Error

hi, I am trying to assign a value through 'read' and all works well until I have a space in the in putted value, for the life of me I cant figure out how to escape this. :wall: Any ideas? #!/bin/sh ask_question() { question_text="${1}"; question_answer=""; ... (2 Replies)
Discussion started by: redback
2 Replies

2. Shell Programming and Scripting

help with bourne shell script

Attempting to write a script to eventually notify me via email for when there is packetloss across the backbone. I am looking for values greater than 0% in the mtr field. #!/bin/sh target=www.google.com date +"%D"_"%T" >> /home/rich/mtr.log echo "----------------------------------------" >>... (1 Reply)
Discussion started by: closedown
1 Replies

3. UNIX for Dummies Questions & Answers

Bourne Shell Script that only takes command line arguments

Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script? The output should be something like this: User userid has a home directory of /path/directory the default shell for this user is /path/shell (5 Replies)
Discussion started by: ajaira
5 Replies

4. UNIX for Advanced & Expert Users

Bourne Shell Script that only takes command line arguments

Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script? The output should be something like this: User userid has a home directory of /path/directory the default shell for this user is /path/shell (1 Reply)
Discussion started by: ajaira
1 Replies

5. Shell Programming and Scripting

Bourne Shell Script that only takes command line arguments

Does anybody know how to Accept a “userid” as a command line argument on a Unix Bourne Shell Script? The output should be something like this: User userid has a home directory of /path/directory the default shell for this user is /path/shell (1 Reply)
Discussion started by: ajaira
1 Replies

6. Shell Programming and Scripting

Bourne Shell: Hiding error messages

I am executing commands as follows in Bourne shell script. Filenames/directory names for the deletion/copying are unknown: rm * rmdir <directory> cp -p * <directory> Sometimes when no file or directory exists, error is encountered. This has no impact or whatever issue to my script but it's... (5 Replies)
Discussion started by: totziens
5 Replies

7. UNIX for Dummies Questions & Answers

How to declare global variables for shell script

Hi, I do have some variables accessed in more than one script. I want to have those variables in a command file anduse them. Something like a header file that we use in C programs. I dont want to set them as environment variables. Is there any other option, like header file in scripting ?? ... (2 Replies)
Discussion started by: risshanth
2 Replies

8. Shell Programming and Scripting

cd from a Bourne Shell Script - Please Help

Dear Bourne Shell Expert, I am trying to change the current working directory from within a Bourne Shell script. Simply enough i thought ! As I am sure you are well aware, Inside the script i echo `pwd` and it seems ok, but the shell spawns another shell to execute this and as such, when my... (10 Replies)
Discussion started by: fawqati
10 Replies

9. Shell Programming and Scripting

bourne shell script

Hi all, Can somebody answer the following query Thanks, Srinivas A shell program that takes one or any number of file directory names as input; sorts the directories given as parameters jointly in the ascending or decending order of choice For EX : dips abc etc desc will sort the files... (2 Replies)
Discussion started by: psrinivas
2 Replies

10. UNIX for Advanced & Expert Users

Bourne shell script need help please ?

i have this assignment.. and i mad this script but there is something wrong with it.. if anyone can tell me.. watz going on... i would appreciate it.. tHnX in advance.. count=1 val=$2 op=$1 ans=0 if then if then while do ... (7 Replies)
Discussion started by: dezithug
7 Replies
Login or Register to Ask a Question