1. TechSpot is dedicated to computer enthusiasts and power users. Ask a question and give support. Join the community here.
    TechSpot is dedicated to computer enthusiasts and power users.
    Ask a question and give support.
    Join the community here, it only takes a minute.
    Dismiss Notice

Linux Mint syntax error

By Dat1Gamer
Mar 19, 2014
Post New Reply
  1. Alright guys, I was adding a line to my .profile for OpenGL to play L4D2 and after I re-booted and all of that when I log in I get this
    "Your session only lasted less than 10 seconds. if you have not logged out yourself, this could mean that there is some installation problem or that you may be out of diskspace. Try logging in with one of the failsafe sessions to see if you can fix this problem.

    View details (~/.xsession-errors file)
    /etc/mdm/Xsession: Beginning session setup...
    etc/mdm/Xsession: 25: /home/milsurp-santa/ .profile: Syntax Error Unterminated Quoted String"

    Any idea what to do?
     
  2. jobeard

    jobeard TS Ambassador Posts: 12,562   +1,442

    Unpaired quotes and double quotes are difficult to find - - some scripting will be required.
    • cat fileName_containing_syntax_error | awk -F\" '{print $1"ZZ"$2"ZZ"$3}'
    • the \" following -F is the character that is unpaired; in this case the double quote
    • this is a pattern to format the scanning: '{print $1"ZZ"$2"ZZ"$3}'
    • if the line(s) have multiple pairs of the quote/double-quotes, then add ZZ$4ZZ$5ZZ$6
    eg: for a file containing:
    if [[ $1 == "--" ]]; then
    the output would be
    if [[ $1 == ZZ--ZZ ]]; then​

    all empty lines will show as ZZZZ

    and the unpaired line will look like
    if [[ $1 == ZZ-- ]]; then
    Then you can discard all the empty lines with egrep -v ZZZZ like this
    • cat fileName_containing_syntax_error | awk -F\" '{print $1"ZZ"$2"ZZ"$3}' | egrep -v ZZZZ
    YEP! Sure gets messy :sigh:

    [edit]
    add NR": " to the pattern and you will see the Line Number in the file;
    • cat fileName_containing_syntax_error | awk -F\" '{print NR":- "$1"ZZ"$2"ZZ"$3}' | egrep -v ZZZZ
    will produce:
    • 151:- if [[ $1 == BB-- ]]; then
    [/edit]
     
    Last edited: Mar 2, 2018
    MirekFe likes this.

Similar Topics

Add your comment to this article

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...