Is it possible to run ksh/bash with an alternative

2019-08-30 06:13发布

问题:

The situation: In my job I often have to su to other userIDs, which means I lose my settings from my .profile - to restore them, I have to manually source my profile.

Isn't there a way to automate this? If there was an option to specify an alternative login script, I could put it into an alias along the lines of:

alias myksh='sudo -u someuser ksh --alt-profile /path/to/my/profile'

回答1:

alias myksh="sudo -u someuser HOME=$HOME ksh"

Also, ksh and bash (with --posix) look for a startup file in the expansion of $ENV



标签: shell