24

I want to set environment variable in linux and did the same by giving command

 export PATH=$PATH:.

But getting error Bad : modifier in $ (.).

Can some one help this. I tried with bash shell and ksh

0

3 Answers 3

51
Bad : modifier in $ (.).

This is not a Bash error, nor is it from Ksh: it's from C-shell or one of its clones such as Tcsh.

You want:

setenv PATH ${PATH}:.

But you should not put . in your ${PATH}, it's a well-known security risk.

7

Dont forget to escape the colon

setenv PYTHONPATH $PYTHONPATH\:/disk1/mypath
2

You might want to try this:

export PATH="${PATH}:."

I don't like having the current directory in the path, but at the end it's fairly safe.

3
  • "fairly safe"? What does that mean?
    – johnsyweb
    Jan 10, 2012 at 16:37
  • @Johnsyweb: well, i had a co-worker who used to do this: export PATH=".:${PATH}" and called a programm he wrote test ....
    – Mithrandir
    Apr 26, 2013 at 11:33
  • 3
    Sounds "fairly unsafe" to me ;)
    – johnsyweb
    Apr 26, 2013 at 22:55

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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