- You have
sshaccess to a server
- You do not know which shell you have (and that the devil changes it next time you log in)
- You want the command
footo be run every time you log in (even non-interactively)
- You want the environment variable
quuxevery time you login (even non-interactively)
In particular you can not assume:
- The operating system
- That shells other than
http://mywiki.wooledge.org/DotFiles (Remote non login non interactive shells) and Can 'ssh <host> <command>' be configured to always load server-side startup files? cover this nicely for Bash, but seem to ignore that the devil might change your login shell to something other than Bash.
What are the similar techniques for ksh, bash, ash, dash, csh, tcsh, zsh? (Spawning
/bin/sh from the login shell is considered cheating by the devil, and is thus not an acceptable answer).