Как запустить команду Tmux в текущей операционной системе?

Вам нужно отредактировать /etc/sudoersи добавить в него пользователя peris . Либо откройте файл с вашим любимым редактированием, напримерvim:

$ sudo vim /etc/sudoers

и добавить пользователя туда под root ALL=(ALL:ALL) ALLс тем же синтаксисом:

peris    ALL=(ALL:ALL) ALL

Или просто отредактируйте его с помощью команды visudo. ПРИМЕЧАНИЕ:Вы должны сделать это с привилегиями root, т.е. sudo.

1
10.08.2020, 11:16
1 ответ

Выполнение условной команды на основе текущей операционной системы (Linux или macOS )в Tmux:

# vim copy to system clipboard
if-shell '[[ $(uname -s) = Linux ]]' { 
   bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" 
} { 
   bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" 
}

if-shellподдерживает опцию(-b)для запуска shell-commandв фоновом режиме; по умолчанию запускается немедленно:

if-shell [-bF] [-t target-pane] shell-command command [command]
              (alias: if)
        Execute the first command if shell-command returns success or the second command otherwise.  Before being executed, shell-command is expanded using the rules specified in the FORMATS section,
        including those relevant to target-pane.  With -b, shell-command is run in the background.

Также(man tmux):

Commands like if-shell, run-shell and display-panes stop execution of subsequent commands on the queue until something happens - if-shell and run-shell until a shell command finishes and display-panes until a key is pressed.  For example, the following commands:

           new-session; new-window
           if-shell "true" "split-window"
           kill-session

Will execute new-session, new-window, if-shell, the shell command true(1), split-window and kill-session in that order.
2
18.03.2021, 23:13

Теги

Похожие вопросы