/
hubbitus
/
shell.scripts
Обзор
Документация
Войти
/
hubbitus
/
shell.scripts
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
SHARED/nested_commands_escape.bash
7 строк
237 B
Pavel Alexeev
Add nested_commands_escape.bash. From http://stackoverflow.com/questions/25941394/how-does-bash-deal-with-nested-quotes/25942100#25942100 (http://chat.stackoverflow.com/rooms/109484/discussion-between-charles-duffy-and-hubbitus)
19 апр 2016, 11:33
19 апр 2016, 11:33
a342ddc
Код
Авторство
О чём код?
#!/bin/bash # http://stackoverflow.com/a/25942100/307525 printf -v command '%q ' date +'%F %X' printf -v outer_command '%q ' sudo -u root bash -c "$command" printf -v ssh_command '%q ' ssh localhost "$outer_command" eval "$ssh_command"