using sed and pstree to display the type of terminal being used

前端 未结 4 1343
慢半拍i
慢半拍i 2021-01-28 14:02

I\'ve been trying to display the type of terminal being used as the name only. For instance if I was using konsole it would display konsole. So far I\'ve been using this command

4条回答
  •  一整个雨季
    2021-01-28 14:30

    curTerm=$(update-alternatives --query x-terminal-emulator | grep '^Best:')
    curTerm=${curTerm##*/}
    
    printf "%s\n" "$curTerm"
    

    And the result is

    terminator
    

    Of course it can be different.
    Now you can use $curTerm variable in your sed command.

    But I am not sure if this is going to work properly with symlinks.

提交回复
热议问题