setenv: check in a more robust way that the script is being sourced
authorAntonio Ospite <ao2@ao2.it>
Tue, 6 Oct 2015 10:26:17 +0000 (12:26 +0200)
committerAntonio Ospite <ao2@ao2.it>
Tue, 6 Oct 2015 10:26:17 +0000 (12:26 +0200)
commitb1642210516b6aeb2762d6811506f4fb6d66c24c
tree538e4d989983b55ac6190ea17568da8c6e093bf7
parent8caef314cc22663d41331f7bf913bee45de47f2a
setenv: check in a more robust way that the script is being sourced

Sometimes a leading '-' shows up in $0 for login shells, for example
this happens when opening a shell with "sudo -i"; in these cases $0 will
look like "-bash" instead of "bash", and the comparison with $(basename
$SHELL) fails even if the script is being sourced.

Fix this by stripping the leading '-'.
setenv