Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

bash won't source files from an login terminal unless I manually run bash from a terminal, I have bash (and not sh or dash). When I source a file, it returs errors (like "syntax error near unexpected " ) unless I don't run $ bash before source

$echo $TERM
screen-256color

$echo $SHELL
/bin/bash

$shopt login_shell
login_shell     on

Error:

$source  ./shrc
-bash: ./shrc: line 105: syntax error near unexpected token `('

$bash 
$source ./shrc <-- now it works

Any ideas?

UPDATE 1

When I run bash, I enter in the non_login shell, and it works. Why login shell is unable to source file?

UPDATE 2

$echo $0
-bash

$bash
$echo $0
bash

UPDATE 3

  else
        echo;
        echo "The SPEC environment variable is not set! Please source the shrc and try again."
        echo;
    fi
  }

  ogo() {   <----- LINE 105
      SHRC_NO_GO=0
      TOP=$SPEC
      if [ "x$TOP" != "x" ]; then
          if [ "x$1" = "x--help" -o "x$1" = "x-h" ]; then

It's a file from SPEC2006 benchmarks (is a well-know program, it is not my code) My assumptions is that it's correct. (infact, on non-login shell, it works)

share|improve this question

1 Answer 1

$SHELL stores your default shell, not your current shell. Try echo $0 instead:

$ echo $SHELL
/bin/bash
$ echo $0
dash
share|improve this answer
    
it returns: -bash –  cento Jul 11 at 12:13
    
@cento: Can you show the line 105, too? –  choroba Jul 11 at 12:44
    
@chroba update 3, added with the code line 105 –  cento Jul 11 at 13:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.