-3

There is a mistake every time a new terminal is opened,

error: "bash: ‘export: command not found"

I only copy export all_proxy="" and export ALL_PROXY="" to terminal,then when I open a new terminal,in the picture of the situation will be appear.

This is picture:

enter image description here

I input the command:

grep export ~/.bashrc

ouput:

enter image description here

I input the command:

env SHELLOPTS=xtrace \
    BASH_XTRACEFD=7 \
    PS4='[${BASH_SOURCE:-$BASH_EXECUTION_STRING}:$LINENO]> ' \
    7> >(grep ‘) bash -l

output:

enter image description here

  • 2
    Can you post the command that gave the error as well as the error itself. It looks like you have a character in front of the command. – bu5hman Nov 23 '17 at 10:36
  • @bu5hman I only copy export all_proxy="" and export ALL_PROXY="" to terminal,then when I open a new terminal,in the picture of the situation will be appear. – user261526 Nov 23 '17 at 10:46
  • Do other bash commands work? Did you do anything to $PATH in this or the previous terminal session? Or edit your bash profile? – bu5hman Nov 23 '17 at 11:00
  • leading single quote before export in .bashrc .bash_profile ? – Archemar Nov 23 '17 at 11:01
  • @bu5hman I don't do anything in $PATH,first occur I reinstall kali linux,the second is still the case.The second I only copy export all_proxy="" and export ALL_PROXY="" to terminal,then when I open a new terminal,in the picture of the situation will be appear. – user261526 Nov 23 '17 at 11:06
2

It looks like you have edited your .bashrc file.

I can replicate this error exactly if I put

'‘export'        

as the last line in my .bashrc

To check it just execute

grep export ~/.bashrc

If grep gives an output like the above then edit it out of your ~/.bashrc file.

Edit: From your last post edit you can see that you have 2 lines starting 'export delete them both from ~/.bashrc.

  • Now what should I do? – user261526 Nov 23 '17 at 11:24
  • Here ` is a backtick. The OP had a character instead. – Stéphane Chazelas Nov 23 '17 at 11:26
  • @StéphaneChazelas Agreed the command is syntactically wrong. The bash error however seems due to the lines in ~/.bashrc. – bu5hman Nov 23 '17 at 11:35
  • Strictly speaking, the command is syntactically correct but just happens to try to invoke a command (‘export) which cannot be found. – Stéphane Chazelas Nov 23 '17 at 12:15
  • @StéphaneChazelas Agreed. Syntactically correct if you are invoking a new command called ‘export, but incorrect if you are trying to call export. We used to call them typo's. A real devil to get them out of the papyrus. – bu5hman Nov 23 '17 at 12:24
5

Assuming you've copy-pasted that command as-is, it's complaining about the ‘export command being not found where that is the U+2018 left single quotation mark non-ASCII character (not to be confused with the ASCII ' apostrophe/single-quote (U+0027) or ASCII ` backtick/grave accent (U+0060) character).

Since that character is not special in any way to bash, a command line like:

‘export foo=bar’

(where is U+2019, the right single quotation mark)

Is interpreted as running the ‘export command with foo=bar’ as argument. Had you written:

'export foo=bar'

instead, that is with those U+2018 and U+2019 replaced with ASCII apostrophe, a character that is special to bash as it's a quoting operator, that would have been treated as running the export foo=bar command with no argument. There is no such command. That is not what you want either.

You want

export foo=bar

or

'export' 'foo=bar'

That is to run the export command with a foo=bar argument.

Here, you'll need to remove that U+2018 character (and possibly the corresponding U+2019 character if any) wherever you've inserted it in your ~/.bashrc or elsewhere. Wherever you copy-pasted that code from, those characters were not intended to be copied.

To find where that bogus command has been introduced if not in ~/.bashrc (though your latest edit shows it is in your ~/.bashrc indeed), you could try running:

env SHELLOPTS=xtrace \
    BASH_XTRACEFD=7 \
    PS4='[${BASH_SOURCE:-$BASH_EXECUTION_STRING}:$LINENO]> ' \
    7> >(grep ‘) bash -l

(the $PS4 would be ignored by shells running as root with bash-4.4 or newer however, which seems to be your case, which is why you see ++ instead of the file name and line number).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy