4

I am learning how to compile using your CompilingEasyHowTo guide. But as soon as I run the command shown below in the terminal, it shows the following error:

tejas@tejas-AU909AA-ACJ-CQ3120IX:~$ sudo chown $tejas /usr/local/src
chown: missing operand after ‘/usr/local/src’

Any idea how to overcome this problem?

0

2 Answers 2

3

You don't need to replace $USER by your own session login name (tejas) as this variable already contains "tejas".

So the right command to use is:

sudo chown $USER /usr/local/src

The variables $ENV, $LOGNAME, $MAIL, $TERM, $USER, and $USERNAME are not Bash builtins. These are, however, often set as environmental variables in one of the Bash or login startup files.

Source: http://tldp.org/LDP/abs/html/internalvariables.html

2

While you don't have to manually substitute your username for $USER, you can if you like. You just have to put it in place of the whole "word" $USER, not just USER. That is, leave off the $ in what you write:

sudo chown tejas /usr/local/src

This is because $ before a "name" signifies it is the name of a variable and that the variable should be dereferenced--that is, replaced by the value stored in it. USER is an environment variable that holds your username.

In contrast, tejas is (probably) not defined (in the sense of being a variable that has been assigned some value). In a shell, a variable that is not defined is treated, in most ways, like it is empty--i.e., holding the empty (i.e., zero-length) string of text. So $tejas is replaced by nothing and the command that actually gets run is sudo chown /usr/local/src, which cannot work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .