gpt4 book ai didi

linux - 如何在 Linux 上的 shell 脚本中获取屏幕分辨率

转载 作者:太空宇宙 更新时间:2023-11-04 05:43:28 27 4
gpt4 key购买 nike

环境

系统:Linux Mint 18/19 Cinnamon 64 位。

shell :dash (POSIX)。

<小时/>

问题

我需要在 POSIX shell 脚本中动态考虑屏幕分辨率。

我更喜欢可重用的函数。

最佳答案

函数

get_screen_resolution()
{
xdpyinfo | awk '/dimensions:/ { print $2 }'
}

用法

resolution=$(get_screen_resolution)

关于linux - 如何在 Linux 上的 shell 脚本中获取屏幕分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37626758/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com