So this question was asked some times already, but the answers didn't seem to work for me. So I have this simple script

charon_id = $(pidof charon)
kill -1 $charon_id

And console says charon_id: command not found*

I've tried different versions, with " around the $( ), ; after the lines, even the $(... 2>&1) I saw somewhere. Nothing has helped so far. Suggestions?

* translated from console language into English


Your problem is with spaces

You wrote

charon_id = $(pidof charon)

This means "run the command charon_id with two parameters; first is the = character and the second is the output of the $(..) command

It should be

charon_id=$(pidof charon)

Now you assign the output to the variable.

  • Now I feel like the noob I am in shell scripting D: Thanks alot! ;)
    – GreenThor
    Jul 15 '16 at 13:06
  • 1
    @GreenThor don't worry about feeling like a noob; you should have seen the mistakes I made when I was one. Fortunately that was almost 30 years ago; I've learned since then :-) Jul 15 '16 at 13:09

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