我想在启动时执行 bash 脚本,在不同的工作区中打开多个终端。如果我从终端调用脚本,脚本工作得很好,但如果使用 @reboot 从 crontab 执行,则脚本不起作用:
#!/usr/bin/env bash
#1 make sure we have enough workspaces
gconftool-2 --set -t int /apps/metacity/general/num_workspaces 7
#2. Launch programs in these terminals
wmctrl -s 6
gnome-terminal --full-screen --execute bash -c "tmux attach; bash"
wmctrl -s 5
gnome-terminal --full-screen --execute bash -c "weechat-curses; bash"
wmctrl -s 4
gnome-terminal --full-screen --execute bash -c "export TERM=xterm-256color; mutt; bash"
wmctrl -s 3
gnome-terminal --full-screen
wmctrl -s 2
gnome-terminal --full-screen
wmctrl -s 1
gnome-terminal --full-screen
wmctrl -s 0
google-chrome …Run Code Online (Sandbox Code Playgroud)