Kannan Ekanath
Kannan Ekanath

Reputation: 17621

Why does Bash return errors with `'ash` when defining a function?

I have a .bashrc file that has a very simple function like this

function module() {
    ....
}

I type "bash" on the command prompt and as expected the .bashrc gets executed however I get the error:

'ash: /user/.bashrc: line 1: syntax error near unexpected token `{
'ash: /user/.bashrc: line 1: `function module() {

I have tried removing the word "function" and I have also tried removing the () but none of this helps. Can someone let me know what is happening?

Bash version when I run bash --version is (I can upgrade to the latest version but ONLY the module will let me point to the latest bash so this problem has to be solved in this bash)

GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.

Upvotes: 2

Views: 525

Answers (1)

Kannan Ekanath
Kannan Ekanath

Reputation: 17621

Actually I was using bash all the time but the .bashrc file was saved in Windows with the Windows CRs. Once I ran dos2unix it worked fine!

Upvotes: 4

Related Questions