Portably, test whether $0 starts with a - : shells normally know that they're login shells because the caller added a - prefix to argument zero (normally the name or .