If you are working on Unix-based systems like Solaris and Linux, then this Techbit is for you.
When you are no longer interested in the current process and want to work on some other process, use
Where is it helpful? I often see people logging on to servers where they find that the shell is Bourne and type
An addendum to the provided example is that if you find yourself repeatedly changing the shell every time you log in to a server, then you should change the default login shell once for all. Of course, this should be done only if the specific login is not being used by any process or application - changing the login shell in such cases would result in the application experiencing unexpected behaviour because it could possibly miss the shell and its start-up parameters thereby. This is a corner case scenario but it needs to be taken into consideration nonetheless.
When you are no longer interested in the current process and want to work on some other process, use
exec
to replace the existing process with new the one.Where is it helpful? I often see people logging on to servers where they find that the shell is Bourne and type
bash
immediately. Nothing is done with the previous shell process plus there's an overhead to exit twice while disconnecting from the server. In such cases, use exec bash
- not only are you going to be more graceful and respectful to using system resources but also increasing productivity by saving yourself from typing exit
twice each and every time!An addendum to the provided example is that if you find yourself repeatedly changing the shell every time you log in to a server, then you should change the default login shell once for all. Of course, this should be done only if the specific login is not being used by any process or application - changing the login shell in such cases would result in the application experiencing unexpected behaviour because it could possibly miss the shell and its start-up parameters thereby. This is a corner case scenario but it needs to be taken into consideration nonetheless.
No comments:
Post a Comment