Sponsored Content
Full Discussion: Badly placed ()'s. - error
Top Forums Shell Programming and Scripting Badly placed ()'s. - error Post 302140359 by amitrajvarma on Friday 12th of October 2007 04:17:44 AM
Old 10-12-2007
Badly placed ()'s. - error

Hi,

when I execute the below script, I am getting following error "Badly placed ()'s". can anyone please help me fix
----------------------------------------------------------
# Usage: ani -n -a -s -w -d
#
#
# help_ani() To print help
#

help_ani()
{
echo "Usage: $0 -n -a -s -w -d"
echo "Options: These are optional argument"
echo " -n name of animal"
echo " -a age of animal"
echo " -s sex of animal "
echo " -w weight of animal"
echo " -d demo values (if any of the above options are used "
echo " their values are not taken)"
exit 1
}
#
#Start main procedure
#
#
#Set default value for variable
#
isdef=0
na=Moti
age="2 Months"
sex=Male
weight=3Kg
#
#if no argument
#
if [ $# -lt 1 ]; then
help_ani()
fi
while getopts n:a:s:w:d opt
do
case "$opt" in
n) na="$OPTARG";;
a) age="$OPTARG";;
s) sex="$OPTARG";;
w) weight="$OPTARG";;
d) isdef=1;;
/?) help_ani;;
esac
done

if [ $isdef -eq 0 ]
then
echo "Animal Name: $na, Age: $age, Sex: $sex, Weight: $weight (user define mode)"
else
na="Pluto Dog"
age=3
sex=Male
weight=20kg
echo "Animal Name: $na, Age: $age, Sex: $sex, Weight: $weight (demo mode)"
fi
------------------------------------

THx

Amit
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

New to it all, But i wanna script really badly!!!

Ok, im brand new to this whole thing, well nearly, but all i wanna know and do is scripting, WHAT DO I DO?!:confused: (3 Replies)
Discussion started by: TheNewGuy
3 Replies

2. Shell Programming and Scripting

for:badly formed number

Hi, I am doing the following but it complains and says "for:badly formed number" does anyone know why? #!/bin/tcsh foreach(....) ............ set depth=64 set width=23 if ($depth==64) then echo "if" set addr_bits=5 else echo "else" endif echo "addr_bits:$addr_bits" echo... (3 Replies)
Discussion started by: ROOZ
3 Replies

3. Shell Programming and Scripting

sed help needed badly

how can I delete one line above and below the matching pattern ? e.g I want to delete the line above and below the line with %CLI- in example below : $CHECKSUM $1$DGA1043:TSTST01.DBF;1 %CLI-E-OPENIN, error opening $1$DGA1043:TSTST01.DBF -RMS-E-FLK, file currently locked by another user ... (6 Replies)
Discussion started by: aliyesami
6 Replies

4. Shell Programming and Scripting

Badly formed number.

I have the following script running every day numerous times a day and it works fine, but very occasionally I get the following error if: Badly formed number. Anyone know why? Here is the script that runs with the follow parms LCTMDBSE 100000 130000 160000 #!/bin/csh ... (0 Replies)
Discussion started by: Northerner
0 Replies

5. UNIX for Dummies Questions & Answers

Need Help Badly: Newbie Here

I have this file: NPANXX|BILLDATE|DIVCODE|COMID|RAO|LIKECODE|BOSS|SORD|STATECODE| 087001|BP01|H|SWBT| |041|IMR6|IMSR6|AR| 087002|BP03|H|SWBT| |042|IMR6|IMSR6|AR| 087003|BP05|H|SWBT| |043|IMR6|IMSR6|AR| .... these are the things that i HAve to do: Insert a new column named “TEST” All... (14 Replies)
Discussion started by: arkhei
14 Replies

6. Shell Programming and Scripting

badly placed ()'s

i'm trying to run the following program but i keep getting the message "badly placed ()'s" can u help? #include "modularity_mat.h" #include "../sparse_mlpl/sparse_matrix.h" adj_matrix_arr* allocate_mem_for_matrix_arr (int y) { /* Create the adj matrix and allocate memory */ ... (2 Replies)
Discussion started by: ronirosner
2 Replies

7. Shell Programming and Scripting

Another case of Badly placed parens.

The shell error message "Badly placed ()'s" can occur for a surprisingly simple oversight. If the script begins with a shell-invocation comment, but is missing the exclamation-point, it is simply a comment and not an invocation. If you attempt to execute it from a shell other than the shell you... (4 Replies)
Discussion started by: Dickster
4 Replies

8. Shell Programming and Scripting

Badly Placed ()'s when trying to use csh

The terminal is bash. Whenever I try to execute csh just by itself it gives Badly Placed ()'s. Whenever I try to use csh with a script it also gives Badly Placed ()'s. My script is this, there is nothing wrong with it, since it used by other students in class as well. (I have also asked... (5 Replies)
Discussion started by: quantumizer
5 Replies

9. Programming

Badly places ()'s on C

I dont know why this Linux would give me badly placed () error all the time for this; #include <stdio.h> int main() { register int num=0 ; while ((num < 5)) ++num; printf("Pass %d \n", num) ; return 0 ; } can anyone help me please? (11 Replies)
Discussion started by: sizzler786
11 Replies

10. Shell Programming and Scripting

Badly placed ()'s

Edit - I don't know how to delete posts. The question I asked here ended up not being the question I should have asked as I didn't realise I needed to edit my script to comply with SGE. Hi, My script is: #!/bin/bash # Perform fastqc on files in a specified directory. for ((j=1;... (8 Replies)
Discussion started by: una1992
8 Replies
gd_endianness(3)						      GETDATA							  gd_endianness(3)

NAME
gd_endianness -- report the byte sex of fields in a dirfile SYNOPSIS
#include <getdata.h> unsigned long gd_endianness(DIRFILE *dirfile, int fragment_index); DESCRIPTION
The gd_endianness() function queries a dirfile(5) database specified by dirfile and returns the byte sex for the fragment indexed by frag- ment_index. The byte sex of a fragment indicate the endianness of data stored in binary files associated with RAW fields defined in the specified fragment. The endianness of a fragment containing no RAW fields is not meaningful. The dirfile argument must point to a valid DIRFILE object previously created by a call to gd_open(3). RETURN VALUE
Upon successful completion, gd_endianness() returns the byte sex of the specified fragment, which will be either GD_BIG_ENDIAN or GD_LIT- TLE_ENDIAN, bitwise-or'd with either GD_ARM_ENDIAN or GD_NOT_ARM_ENDIAN, indicating whether double-precision floating point data in this fragment are stored in the old ARM middle-endian format. On error, it returns zero and sets the dirfile error to a non-zero error value. Possible error values are: GD_E_BAD_DIRFILE The supplied dirfile was invalid. GD_E_BAD_INDEX The supplied index was out of range. The dirfile error may be retrieved by calling gd_error(3). A descriptive error string for the last error encountered can be obtained from a call to gd_error_string(3). SEE ALSO
gd_alter_endianness(3), gd_getdata(3), gd_error(3), gd_error_string(3), gd_open(3), dirfile(5), dirfile-format(5) Version 0.7.0 17 July 2010 gd_endianness(3)
All times are GMT -4. The time now is 10:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy