I am trying to expand the variable $user in my alias command and tried
several variations of eval but can't seem to get it to work.
The end result should be either:
oracle_user='sudo su - oracle ' or oracle_user='sudo su - oracle1 '
user=$(grep '^oracle:' /etc/passwd | cut -d":" -f1 )
if [ -z "$user" ]
then
user=$(grep '^oracle1:' /etc/passwd | cut -d":" -f1 )
if [ -z "user" ]
then
echo "users oracle or oracle1 not found."
fi
fi
alias -x oracle_user='sudo su - $user '