We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use login-ctl to get username, use w instead of who to get display variable directly.
w
who
--- batify/xpub/src/xpub.sh 2021-03-24 20:46:54.288945317 +0100 +++ /usr/local/bin/xpub 2021-03-24 21:22:25.474690184 +0100 @@ -66,7 +66,7 @@ ${tFlag} && xtty="${tArg}" || xtty="$(cat /sys/class/tty/tty0/active)" - xuser="$(who | grep "${xtty}" | head -n 1 | cut -d' ' -f1)" + xuser="$(loginctl list-sessions | grep "${xtty}" | awk '{print $3}' )" [ -z "${xuser}" ] && { echo "No user found from ${xtty}." 1>&2; exit 1; } @@ -75,7 +75,7 @@ if [ -n "${xpids}" ]; then for xpid in ${xpids}; do - xdisplay="$(ps -o cmd= "${xpid}" | grep "${vterm}" | grep -E -o ':[0-9]')" + xdisplay="$(w | grep "${xuser}" | grep -E -o ':[0-9]' | sort -u)" if [ "$?" -eq 0 ]; then xdisplay="$(echo "${xdisplay}" | head -n1)" break
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Use login-ctl to get username, use
w
instead ofwho
to get display variable directly.The text was updated successfully, but these errors were encountered: