In bash if you run echo $0
you’ll get -bash
for login shells and bash
for non-login shells. The bash manual says this:
A login shell is one whose first character of argument zero is a -, or one started with the --login option.
Other shells work similarly. However if I try to do the equivalent echo @args[0]
in Ion, I get:
ion: expansion error: invalid index
What would be the proper way to detect if I’m in a login or non-login shell in Ion?
–
The problem I’m trying to solve is that I want a command to run every time I login, but not every time I open a terminal.