hi, i'm new at unix and am writing a program to classify data into data types (str, int, float); however, everytime i try to run it for debugging purposes, i get an error.
the error is:
the program is:Code:./data_type.bash: line 72: syntax error: unexpected end of file
please help!Code:#!/bin/bash # # data_type # by: james brumond # # used for determining the data type of a string. # returns one of the following: # [str | int | float] # # when used with the -s option, it can be used to # change an int or float into a str. # # exit status codes: # 64 - improper option use # helpMsg="data_type\nby:james brumond\nused to assign and determine data types.\n\ available data types for use are: [str | int | float]\n\n\ format for this command is: data_type [variable name] [options]\n\n\ options:\n-s:type manually sets the data_type of a variable to type\n\ -h displays this help message\n\n\ typing this command with no options but with a valid variable name\n\ will echo the data_type of the variable." if [ "$#" -eq 0 ] then echo "$helpMsg" exit 0 elif [ "$#" -eq 1 ] then if [ "$1" = -h ] then echo "$helpMsg" exit 0 else # auto type set dataType="$?" if [ "$dataType" -eq 65 ] then echo "str" exit 0 elif [ "$dataType" -eq 66 ] then echo "int" exit 0 elif [ "$dataType" -eq 67 ] then echo "float" exit 0 fi fi elif [ "$#" -eq 2 ] then if [ "$2" != -s:* ] then exit 64 # incorrect option use else # manual type set dataType="$?" if [ "$dataType" = 65 ] then echo "str" exit 0 elif [ "$dataType" = 66 ] then echo "int" exit 0 elif [ "$dataType" = 67 ] then echo "float" exit 0 fi


LinkBack URL
About LinkBacks

Reply With Quote
Thanks to those whom have donated so far!
