Difference between exit and logout

Skippy le Grand Gourou picture Skippy le Grand Gourou · May 15, 2013 · Viewed 9.9k times · Source

Not sure it is related to VxWorks or to rlogin, but anyway.

I read one should never use the exit command to quit a VxWorks rsh shell, but only the logout command. However I can't seem to find an explanation. What is the difference between those two commands ?

Thanks.

Answer

Benoit picture Benoit · May 24, 2013

If rsh connects to the vxWorks Kernel Shell (i.e. the -> prompt) then the advise makes sense.

The kernel shell is typically a permanent task that parses whatever the user types and executes the appropriate function.

When you type a "command", the shell actually looks up the symbol (i.e. global variable or function) and if it's a function, it will call the function with whatever parameters you pass in.

logout() is presumably a function related to closing the RSH connection.

However, exit() is a standard C function which terminates the current process (or Task in vxWorks). Which means that you would just have killed the actual kernel shell task (vs. just the RSH connection). Probably not what you mean to do.

Normally the shell is set to auto-restart, but why tempt fate...