Sponsored Content
Top Forums Shell Programming and Scripting Syntax error: Unterminated quoted string Post 302297464 by evilSerph on Friday 13th of March 2009 01:43:25 PM
Old 03-13-2009
Syntax error: Unterminated quoted string

I keep having problems when exicuting this file. It always gives me the error message "36: Syntax error: Unterminated quoted string"
If someone could help me edit this it would be much appreciated.

Code:
#!/bin/sh
#
# This will continue adding numbers
# untill the total is greater than 1,000
#
if test $num1=0
  then
    {
        echo "Please enter two numbers."
        read num1 Total
        echo "The number you entered is $num1"
        Total = `expr $Total + $num1`
    }
  elif test $num1>0
    then
      {
        echo "The current value is $Total."
        echo "Please enter another number."
        read num1
        echo "The number you entered is $num1"
        Total = `expr $Total + $num1`
      }
  elif test $num1<0
    then
      {
        echo "I'm sorry, the value you entered is invalid"
        echo "Please enter a number that is greater than zero."
        read num1
        echo "The number you entered is $num1"
        Total = `expr $Total + $num1`"
      }
  else
      {
        echo "Total is greater than 1,000\n"
        echo "CAN NOT COMPUTE!!!!!\n"
        echo "System shutdown"
      }
fi


Last edited by DukeNuke2; 03-13-2009 at 03:00 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unterminated string

While running a shell script i am getting this warning but the script is working fine.while running the blocks of the scripts individually its running fine.But while pasting it combinedly this is the warning..wat may be the reason behind this and how to resolve it (3 Replies)
Discussion started by: dr46014
3 Replies

2. Shell Programming and Scripting

how to delete blanks inside a quoted string

Hi I need to update a string inside a file which looks like the following: PX_LIST=" 4119 2390 2294 2776 2897 4099 " Is there a way to get rid of the blanks after the first quote mark and before the last quote mark. This needs to be done ONLY for the string named PX_LIST (there are some... (4 Replies)
Discussion started by: aoussenko
4 Replies

3. Shell Programming and Scripting

Unterminated quoted string

Hello! I wroted a little script that should check for new updates on a server and get them if any. The problem is, every time I run it with sh, I'm getting an "script: 20: Syntax error: Unterminated quoted string" error! The problem is, there isn't any "unterminated quoted string" in my script:... (2 Replies)
Discussion started by: al0x
2 Replies

4. Shell Programming and Scripting

Take quoted output from one script as quoted input for another script

Hi, I have a script output.sh which produces the following output (as an example): "abc def" "ghi jkl" This output should be handled from script input.sh as input and the quotes should be treated as variable delimiters but not as regular characters. input.sh (processing positional... (2 Replies)
Discussion started by: stresing
2 Replies

5. UNIX for Dummies Questions & Answers

sed error unterminated `s' command

I have list of data I have cut down to format: I am using sed command to remove the sed 's/ Returns error: sed: -e expression #1, char 5: unterminated `s' command Full code line is: cat textFile | cut -d ' ' -f 4 | cut ':' -f 1 | sed 's/ Thanks, Please use next time code tags... (2 Replies)
Discussion started by: maximus73
2 Replies

6. Shell Programming and Scripting

sed returns error "sed: -e expression #1, char 18: unterminated `s' command"

Hello All, I have something like below LDC100/rel/prod/libinactrl.a LAA2000/rel/prod/libinactrl.a I want to remove till first forward slash that is outputshould be as below rel/prod/libinactrl.a rel/prod/libinactrl.a How can I do that ??? (8 Replies)
Discussion started by: anand.shah
8 Replies

7. Shell Programming and Scripting

Deleting double quoted string from a line when line number is variable

I need to remove double quoted strings from specific lines in a file. The specific line numbers are a variable. For example, line 5 of the file contains A B C "string" I want to remove "string". The following sed command works: sed '5 s/\"*\"//' $file If there are multiple... (2 Replies)
Discussion started by: rennatsb
2 Replies

8. UNIX for Dummies Questions & Answers

Getting " Unterminated quoted string"

Hi Guys, When I am executing the script #! /bin/bash SARBACKUPS=/home/pradeep/sarBackups cd /var/log/sysstat ls -1t sar* | while read SARNAME do cp -p "$SARNAME" $( echo "$SARBACKUPS"/"$HOSTNAME"_"$SARNAME"_"`date +"%Y%m%d`.bkup ) done I am getting final.sh: 1: Syntax... (3 Replies)
Discussion started by: Pradeep_1990
3 Replies

9. Shell Programming and Scripting

Replace double quotes with a single quote within a double quoted string

Hi Froum. I have tried in vain to find a solution for this problem - I'm trying to replace any double quotes within a quoted string with a single quote, leaving everything else as is. I have the following data: Before: ... (32 Replies)
Discussion started by: pchang
32 Replies

10. Shell Programming and Scripting

awk string comparison unterminated quoted string andrule of thumb

I have the logic below to look up for matches within the columns between the two files with awk. In the if statement is where the string comparison is attempted with == The issue seems to be with the operands, as 1. when " '${SECTOR}' " -- double quote followed by single quote -- awk matches... (1 Reply)
Discussion started by: deadyetagain
1 Replies
MPI_Error_string(3OpenMPI)												MPI_Error_string(3OpenMPI)

NAME
MPI_Error_string - Returns a string for a given error code. SYNTAX
C Syntax #include <mpi.h> int MPI_Error_string(int errorcode, char *string, int *resultlen) Fortran Syntax INCLUDE 'mpif.h' MPI_ERROR_STRING(ERRORCODE, STRING, RESULTLEN, IERROR) INTEGER ERRORCODE, RESULTLEN, IERROR CHARACTER*(*) STRING C++ Syntax #include <mpi.h> void Get_error_string(int errorcode, char* name, int& resultlen) INPUT PARAMETER
errorcode Error code returned by an MPI routine or an MPI error class. OUTPUT PARAMETERS
string Text that corresponds to the errorcode. resultlen Length of string. IERROR Fortran only: Error status (integer). DESCRIPTION
Returns the error string associated with an error code or class. The argument string must represent storage that is at least MPI_MAX_ERROR_STRING characters long. The number of characters actually written is returned in the output argument, resultlen. ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ func- tions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object. Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. SEE ALSO
MPI_Error_class Open MPI 1.2 September 2006 MPI_Error_string(3OpenMPI)
All times are GMT -4. The time now is 01:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy