With the below command, I can get the listener name in the listener.ora for the current $ORACLE_HOME
grep ' =$' $ORACLE_HOME/network/admin/listener.ora | grep -v '(' | grep -v 'SID_LIST' | sed 's/=//g'
However, my goal is to get that to output from dropping out of SQLPLUS.
SQL> !lsnrctl status
So that the above command will use the output of the grep:
SQL> !lsnrctl status <output_of_grep>
I am floundering around trying to put it all into some variable but my unix skills are failing me. And, actually I do not know if it is even possible to do that, can anyone help?
You can further pipe the grep command to xargs. See for example:
grep ' =$' $ORACLE_HOME/network/admin/listener.ora | grep -v '(' | grep -v 'SID_LIST' | sed 's/=//g' | xargs -n 1 lsnrctl status
I have extended your grep and sent it to lsnrctl via xargs.