The Shell initially Invoked After I Power On My Computer is Login or Non-login Shell? [duplicate]

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
-2
down vote

favorite













This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



I read multiple articles refering the login shell and non-login shell,

still, I am very confused.
Difference between Login Shell and Non-Login Shell? - Unix & Linux Stack Exchange
The UNIX School: Login shell or a non-login shell?



Put it simple,

the shell I start from my own computer after I power on it,

Isn't it a login shell or non-login shell?



 $ echo $SHELL
/bin/bash
$ echo $0
-bash


Additionally, Could you please help to determine taht the shell called from a program is login shell or not?



 import subprocess
subprocess.run('ls -l', shell=True)






share|improve this question














marked as duplicate by jasonwryan, muru, G-Man, Christopher, jimmij Apr 2 at 16:52


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    From one of the answers to the above: "# "-" is the first character. Therefore, this is a login shell.", and as for the program, that depends on on the program, doesn't it?
    – muru
    Apr 2 at 3:32















up vote
-2
down vote

favorite













This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



I read multiple articles refering the login shell and non-login shell,

still, I am very confused.
Difference between Login Shell and Non-Login Shell? - Unix & Linux Stack Exchange
The UNIX School: Login shell or a non-login shell?



Put it simple,

the shell I start from my own computer after I power on it,

Isn't it a login shell or non-login shell?



 $ echo $SHELL
/bin/bash
$ echo $0
-bash


Additionally, Could you please help to determine taht the shell called from a program is login shell or not?



 import subprocess
subprocess.run('ls -l', shell=True)






share|improve this question














marked as duplicate by jasonwryan, muru, G-Man, Christopher, jimmij Apr 2 at 16:52


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    From one of the answers to the above: "# "-" is the first character. Therefore, this is a login shell.", and as for the program, that depends on on the program, doesn't it?
    – muru
    Apr 2 at 3:32













up vote
-2
down vote

favorite









up vote
-2
down vote

favorite












This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



I read multiple articles refering the login shell and non-login shell,

still, I am very confused.
Difference between Login Shell and Non-Login Shell? - Unix & Linux Stack Exchange
The UNIX School: Login shell or a non-login shell?



Put it simple,

the shell I start from my own computer after I power on it,

Isn't it a login shell or non-login shell?



 $ echo $SHELL
/bin/bash
$ echo $0
-bash


Additionally, Could you please help to determine taht the shell called from a program is login shell or not?



 import subprocess
subprocess.run('ls -l', shell=True)






share|improve this question















This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



I read multiple articles refering the login shell and non-login shell,

still, I am very confused.
Difference between Login Shell and Non-Login Shell? - Unix & Linux Stack Exchange
The UNIX School: Login shell or a non-login shell?



Put it simple,

the shell I start from my own computer after I power on it,

Isn't it a login shell or non-login shell?



 $ echo $SHELL
/bin/bash
$ echo $0
-bash


Additionally, Could you please help to determine taht the shell called from a program is login shell or not?



 import subprocess
subprocess.run('ls -l', shell=True)




This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers









share|improve this question













share|improve this question




share|improve this question








edited Apr 2 at 3:37

























asked Apr 2 at 3:00









JawSaw

29410




29410




marked as duplicate by jasonwryan, muru, G-Man, Christopher, jimmij Apr 2 at 16:52


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by jasonwryan, muru, G-Man, Christopher, jimmij Apr 2 at 16:52


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1




    From one of the answers to the above: "# "-" is the first character. Therefore, this is a login shell.", and as for the program, that depends on on the program, doesn't it?
    – muru
    Apr 2 at 3:32













  • 1




    From one of the answers to the above: "# "-" is the first character. Therefore, this is a login shell.", and as for the program, that depends on on the program, doesn't it?
    – muru
    Apr 2 at 3:32








1




1




From one of the answers to the above: "# "-" is the first character. Therefore, this is a login shell.", and as for the program, that depends on on the program, doesn't it?
– muru
Apr 2 at 3:32





From one of the answers to the above: "# "-" is the first character. Therefore, this is a login shell.", and as for the program, that depends on on the program, doesn't it?
– muru
Apr 2 at 3:32











1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










As noted in this answer:




prompt> echo $0
-bash # "-" is the first character. Therefore, this is a login shell.



So your first example shows a login shell.



As also noted in the same answer,




Information can be found in man bash (search for Invocation). Here
is an excerpt:




A login shell is one whose first character of argument zero is a -, or
one started with the --login option.





And from the Python docs:




... Popen does the equivalent of:



Popen(['/bin/sh', '-c', args[0], args[1], ...])



Since the only option given is -c, it's not a login shell.






share|improve this answer



























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    As noted in this answer:




    prompt> echo $0
    -bash # "-" is the first character. Therefore, this is a login shell.



    So your first example shows a login shell.



    As also noted in the same answer,




    Information can be found in man bash (search for Invocation). Here
    is an excerpt:




    A login shell is one whose first character of argument zero is a -, or
    one started with the --login option.





    And from the Python docs:




    ... Popen does the equivalent of:



    Popen(['/bin/sh', '-c', args[0], args[1], ...])



    Since the only option given is -c, it's not a login shell.






    share|improve this answer
























      up vote
      1
      down vote



      accepted










      As noted in this answer:




      prompt> echo $0
      -bash # "-" is the first character. Therefore, this is a login shell.



      So your first example shows a login shell.



      As also noted in the same answer,




      Information can be found in man bash (search for Invocation). Here
      is an excerpt:




      A login shell is one whose first character of argument zero is a -, or
      one started with the --login option.





      And from the Python docs:




      ... Popen does the equivalent of:



      Popen(['/bin/sh', '-c', args[0], args[1], ...])



      Since the only option given is -c, it's not a login shell.






      share|improve this answer






















        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        As noted in this answer:




        prompt> echo $0
        -bash # "-" is the first character. Therefore, this is a login shell.



        So your first example shows a login shell.



        As also noted in the same answer,




        Information can be found in man bash (search for Invocation). Here
        is an excerpt:




        A login shell is one whose first character of argument zero is a -, or
        one started with the --login option.





        And from the Python docs:




        ... Popen does the equivalent of:



        Popen(['/bin/sh', '-c', args[0], args[1], ...])



        Since the only option given is -c, it's not a login shell.






        share|improve this answer












        As noted in this answer:




        prompt> echo $0
        -bash # "-" is the first character. Therefore, this is a login shell.



        So your first example shows a login shell.



        As also noted in the same answer,




        Information can be found in man bash (search for Invocation). Here
        is an excerpt:




        A login shell is one whose first character of argument zero is a -, or
        one started with the --login option.





        And from the Python docs:




        ... Popen does the equivalent of:



        Popen(['/bin/sh', '-c', args[0], args[1], ...])



        Since the only option given is -c, it's not a login shell.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 2 at 4:09









        muru

        33.3k576141




        33.3k576141












            4Csdm8pN7vdQgGENmi44Q,m,Pz5gfHVFyFBwjPg,05bWoVLefsx Vlr8 dF295GNlSUl BBard7
            wk6w8RURLsiPVlOw3Mkg3EIYtYU7V0fzYzSkA47h 3w,N1MW6Uyw0xQiurapAY 80SZrtvx,NAvp2Wt,a1 HnRrLz,L,L

            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            How many registers does an x86_64 CPU actually have?

            Displaying single band from multi-band raster using QGIS