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.