-2

I am studying about environment in linux, and these words confuses me. isn't there just system defined variables generated by kernel and user defined variables which is assume to be lower case?? commands uses aliases also user defined for specific terminal window?!

I make a command using

alias echi="helloooo"

and use this in another terminal tab and I expect to give an error

command not found

because of my user defined command but it just run without any error or output

Kusalananda
  • 333,661
  • The kernel does not define any variables or aliases for the user. login (or sshd) and pam libraries will set some variables and shell initialization scripts in /etc or /home/username will set others. – doneal24 Apr 16 '23 at 17:32

1 Answers1

1

It should give you an error. Did it produce some other result? Do you have something else under either of those names? (type helloooo or type echi).

Aliases are loaded into the environment when the shell initializes and sources all its various files, but aliases don't get used on shell startup. And unless you're using something to synchronize session environment between two terminals, they won't have access to each others' environments (that's why we use things like bashrc, zshrc, etc.).

There are a bunch of things already set as variables in your environment, which are different (no alias keyword). You can see those by running env.

This post has some good details on the differences between aliases, functions, and executables. This one explains the environment a bit more, including links and variables. And for an in-depth reference, Greg Wooledge's Bash Wiki deserves a place in every Unix user's bookmarks.

Zac Anger
  • 223