Tech_20
asked on
Unix script error
I have a unix script (validint.bash) that continues to give the following error after I type the file name and following input...
sh-3.2# bash validint.bash 123.45
Then I get this error message...
: command not found 3:
'alidint.bash: line 4: syntax error near unexpected token `{
'alidint.bash: line 4: `function validint() {
I attached the script below in a text (.rtf) file. Please help. Thanks.
unix-script.rtf
sh-3.2# bash validint.bash 123.45
Then I get this error message...
: command not found 3:
'alidint.bash: line 4: syntax error near unexpected token `{
'alidint.bash: line 4: `function validint() {
I attached the script below in a text (.rtf) file. Please help. Thanks.
unix-script.rtf
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. The comments on variable assignments, carriage returns and choice of code editor helped!
ASKER
input
sh-3.2# bash validFloat.bash 1234.56
output
validint2.bash: line 12: [: missing `]'
validint2.bash: line 19: [: missing `]'
validFloat.bash: line 32: [: fractionalPart: unary operator expected
1234.56 is a valid floating-point value
Any other suggestions.
validint2.rtf
validFloat2.rtf