简体   繁体   中英

Issue in the output of a printing a last login user in bash shell scripting?

while:
do
    tput cup 10 50 ; echo -n " 1. Print last user login"
    tput cup 12 50; echo -n " 2. Quit"
    tput cup 14 50 ; echo -n " select the option"
    tput cup 14 70
    tput sc
    read y
    tput cup 20 30
    case "$y" in
        1|C|c)
            lastlog |sed 's/\|/ /'awk'{print $1}'
            ;;
        2|Q|q)
            tput reset
            clear
            exit
            ;;
        *)
            tput cup 17 50
            echo "Unknown option"
            tput rc
            ;;
    esac
done

When i try to display the output its displaying as shown in the image,what command should i include ? 在此处输入图片说明

while :
do
    tput cup 10 50; echo -n  1. Print last user login
    tput cup 12 50; echo -n  2. Quit
    tput cup 14 50; echo -n  select the option
    tput cup 16 50
    tput sc
    read y
    tput cup 20 50
    case $y in
        1|C|c)
            lastlog |sed 's/\|/ /'awk'{print $1}'
            ;;
        2|Q|q)
            tput reset
            clear
            exit
            ;;
        *)
            tput cup 18 50
            echo Unknown option
            tput rc
            ;;
    esac
done

You add all double quotes back here it's not allowing double quotes so I removed it...
Try this one...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM