Why script name ($0) is different when logged in over ssh? [duplicate]

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











up vote
0
down vote

favorite













This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



  • Why we can not see a single hyphen from $0 on a login shell invoked with `--login` option?

    2 answers



When I open a terminal on my own computer and run echo $0, I get /bin/bash - which is the name of the executable being run.



However, when I run echo $0 in an ssh session, I get -bash. Why? What does the dash mean? It's not like there is a command named -bash.










share|improve this question













marked as duplicate by Jeff Schaller, Tim Kennedy, Thomas, Stephen Kitt bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Oct 3 at 19:03


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




    Or better: unix.stackexchange.com/q/38175/117549
    – Jeff Schaller
    Oct 3 at 18:53














up vote
0
down vote

favorite













This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



  • Why we can not see a single hyphen from $0 on a login shell invoked with `--login` option?

    2 answers



When I open a terminal on my own computer and run echo $0, I get /bin/bash - which is the name of the executable being run.



However, when I run echo $0 in an ssh session, I get -bash. Why? What does the dash mean? It's not like there is a command named -bash.










share|improve this question













marked as duplicate by Jeff Schaller, Tim Kennedy, Thomas, Stephen Kitt bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Oct 3 at 19:03


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




    Or better: unix.stackexchange.com/q/38175/117549
    – Jeff Schaller
    Oct 3 at 18:53












up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



  • Why we can not see a single hyphen from $0 on a login shell invoked with `--login` option?

    2 answers



When I open a terminal on my own computer and run echo $0, I get /bin/bash - which is the name of the executable being run.



However, when I run echo $0 in an ssh session, I get -bash. Why? What does the dash mean? It's not like there is a command named -bash.










share|improve this question














This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



  • Why we can not see a single hyphen from $0 on a login shell invoked with `--login` option?

    2 answers



When I open a terminal on my own computer and run echo $0, I get /bin/bash - which is the name of the executable being run.



However, when I run echo $0 in an ssh session, I get -bash. Why? What does the dash mean? It's not like there is a command named -bash.





This question already has an answer here:



  • Difference between Login Shell and Non-Login Shell?

    4 answers



  • Why we can not see a single hyphen from $0 on a login shell invoked with `--login` option?

    2 answers







bash shell ssh






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 3 at 18:46









Jan Warchoł

353317




353317




marked as duplicate by Jeff Schaller, Tim Kennedy, Thomas, Stephen Kitt bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Oct 3 at 19:03


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 Jeff Schaller, Tim Kennedy, Thomas, Stephen Kitt bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Oct 3 at 19:03


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




    Or better: unix.stackexchange.com/q/38175/117549
    – Jeff Schaller
    Oct 3 at 18:53












  • 1




    Or better: unix.stackexchange.com/q/38175/117549
    – Jeff Schaller
    Oct 3 at 18:53







1




1




Or better: unix.stackexchange.com/q/38175/117549
– Jeff Schaller
Oct 3 at 18:53




Or better: unix.stackexchange.com/q/38175/117549
– Jeff Schaller
Oct 3 at 18:53















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)