bash script non-interactive login shell
Hi
I'm focusing on getting my head around interactive v non-interactive shells, both non-login and login. Basically what scripts are run and how local and global variables behave.
I'm pretty much there except for 'non-interactive login shells'. I understand that 'non-interactive' shells are started when a script is run. However, if I start my script with #!/bin/bash --login, then a 'non-interactive login' shell will be started.
In my mind I would have expected this to be the same as logging in from scratch, albeit without a user\password prompt. In this case I would have thought that any exported variables from the parent shell would be blown away. This doesn't appear to be the case. The 'non-interactive login' shell appears to inherit the environment of its parent 'interactive' shell.
Can anyone explain the purpose of a 'non-interactive login' shell and how they behave in this regard.
Hope this makes sense.
Cheers
Mike
Last edited by mick66; 03-17-2015 at 05:18 AM.
|