<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://support.qbpro.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9A%D0%B0%D0%BA_%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C_%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA_%D0%B8%D0%B7_bash_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0</id>
	<title>Как сделать бинарник из bash скрипта - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://support.qbpro.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%9A%D0%B0%D0%BA_%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C_%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA_%D0%B8%D0%B7_bash_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0"/>
	<link rel="alternate" type="text/html" href="https://support.qbpro.ru/index.php?title=%D0%9A%D0%B0%D0%BA_%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C_%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA_%D0%B8%D0%B7_bash_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0&amp;action=history"/>
	<updated>2026-04-04T00:56:03Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.38.1</generator>
	<entry>
		<id>https://support.qbpro.ru/index.php?title=%D0%9A%D0%B0%D0%BA_%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C_%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA_%D0%B8%D0%B7_bash_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0&amp;diff=2849&amp;oldid=prev</id>
		<title>imported&gt;Vix в 13:25, 16 апреля 2019</title>
		<link rel="alternate" type="text/html" href="https://support.qbpro.ru/index.php?title=%D0%9A%D0%B0%D0%BA_%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C_%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA_%D0%B8%D0%B7_bash_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0&amp;diff=2849&amp;oldid=prev"/>
		<updated>2019-04-16T13:25:01Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 16:25, 16 апреля 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Строка 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Появилась необходимость, скомпилировать bash скрипт в бинарный исполняемый файл. Смысл и цели этих манипуляций каждый может найти себе сам, вдруг понадобится. Нашелся такой &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;проект &lt;/del&gt;http://www.datsi.fi.upm.es/~frosal/, некоего Francisco Javier Rosales García. Утилита называется shc, транслятор языка bash в C, с последующей компиляцией в двоичный формат. Все манипуляции производим на виртуальной машине с debian 8 jessie на борту. Скачиваем архив, разархивируем, компилируем:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Появилась необходимость, скомпилировать &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;bash&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''' &lt;/ins&gt;скрипт в бинарный исполняемый файл. Смысл и цели этих манипуляций каждый может найти себе сам, вдруг понадобится. Нашелся такой &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/ins&gt;http://www.datsi.fi.upm.es/~frosal/ &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;проект]&lt;/ins&gt;, некоего &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;Francisco Javier Rosales García&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;. Утилита называется &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;shc&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;, транслятор языка &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;bash&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''' &lt;/ins&gt;в &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;C&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;, с последующей компиляцией в двоичный формат. Все манипуляции производим на виртуальной машине с &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;debian 8 jessie&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''' &lt;/ins&gt;на борту. Скачиваем архив, разархивируем, компилируем:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  root@debian8:~ # wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  root@debian8:~ # wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Строка 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Собственно инструмент готов, можно использовать.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Собственно инструмент готов, можно использовать.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Использование shc&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Использование &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;shc&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Список возможных опций:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Список возможных опций:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l39&quot;&gt;Строка 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 39:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      Please consult the shc(1) man page.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;      Please consult the shc(1) man page.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Для проверки накидаем скрипт script.sh в пару строк:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Для проверки накидаем скрипт &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;script.sh&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''' &lt;/ins&gt;в пару строк:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  #!/bin/bash&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l53&quot;&gt;Строка 53:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Строка 53:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  root@debian8:~/shc-3.8.9b # ./shc -r -T -f ./script.sh&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  root@debian8:~/shc-3.8.9b # ./shc -r -T -f ./script.sh&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;На выходе получаем 2 новых файла: script.sh.x - двоичный исполняемый файл script.sh.x.c - С код полученный из bash скрипта, при желании его можно подправить руками и скомпилировать штатными средствами системы. Проверяем бинарник:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;На выходе получаем 2 новых файла: &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;script.sh.x&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''' &lt;/ins&gt;- двоичный исполняемый файл &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;script.sh.x.c&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''' &lt;/ins&gt;- С код полученный из &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;bash&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;''' &lt;/ins&gt;скрипта, при желании его можно подправить руками и скомпилировать штатными средствами системы. Проверяем бинарник:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  root@debian8:~/shc-3.8.9b # ./script.sh.x &amp;quot;binary file&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  root@debian8:~/shc-3.8.9b # ./script.sh.x &amp;quot;binary file&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key pgdb4support-mediawiki-:diff::1.12:old-2848:rev-2849 --&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Vix</name></author>
	</entry>
	<entry>
		<id>https://support.qbpro.ru/index.php?title=%D0%9A%D0%B0%D0%BA_%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C_%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA_%D0%B8%D0%B7_bash_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0&amp;diff=2848&amp;oldid=prev</id>
		<title>imported&gt;Vix: Новая страница: «Появилась необходимость, скомпилировать bash скрипт в бинарный исполняемый файл. Смысл и...»</title>
		<link rel="alternate" type="text/html" href="https://support.qbpro.ru/index.php?title=%D0%9A%D0%B0%D0%BA_%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C_%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA_%D0%B8%D0%B7_bash_%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0&amp;diff=2848&amp;oldid=prev"/>
		<updated>2019-04-16T13:22:51Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «Появилась необходимость, скомпилировать bash скрипт в бинарный исполняемый файл. Смысл и...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Появилась необходимость, скомпилировать bash скрипт в бинарный исполняемый файл. Смысл и цели этих манипуляций каждый может найти себе сам, вдруг понадобится. Нашелся такой проект http://www.datsi.fi.upm.es/~frosal/, некоего Francisco Javier Rosales García. Утилита называется shc, транслятор языка bash в C, с последующей компиляцией в двоичный формат. Все манипуляции производим на виртуальной машине с debian 8 jessie на борту. Скачиваем архив, разархивируем, компилируем:&lt;br /&gt;
&lt;br /&gt;
 root@debian8:~ # wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz&lt;br /&gt;
 root@debian8:~ # tar -xzf ./shc-3.8.9b.tgz&lt;br /&gt;
 root@debian8:~ # cd shc-3.8.9b&lt;br /&gt;
 root@debian8:~/shc-3.8.9b # make&lt;br /&gt;
 cc -Wall  shc.c -o shc&lt;br /&gt;
 ***     ▒Do you want to probe shc with a test script?&lt;br /&gt;
 ***     Please try...   make test&lt;br /&gt;
&lt;br /&gt;
Собственно инструмент готов, можно использовать.&lt;br /&gt;
Использование shc&lt;br /&gt;
Список возможных опций:&lt;br /&gt;
&lt;br /&gt;
 root@debian8:~/shc-3.8.9b # ./shc -help&lt;br /&gt;
 shc Version 3.8.9b, Generic Script Compiler&lt;br /&gt;
 shc Copyright (c) 1994-2015 Francisco Rosales &lt;br /&gt;
 shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script&lt;br /&gt;
 &lt;br /&gt;
     -e %s  Expiration date in dd/mm/yyyy format [none]&lt;br /&gt;
     -m %s  Message to display upon expiration [&amp;quot;Please contact your provider&amp;quot;]&lt;br /&gt;
     -f %s  File name of the script to compile&lt;br /&gt;
     -i %s  Inline option for the shell interpreter i.e: -e&lt;br /&gt;
     -x %s  eXec command, as a printf format i.e: exec('%s',@ARGV);&lt;br /&gt;
     -l %s  Last shell option i.e: --&lt;br /&gt;
     -r     Relax security. Make a redistributable binary&lt;br /&gt;
     -v     Verbose compilation&lt;br /&gt;
     -D     Switch ON debug exec calls [OFF]&lt;br /&gt;
     -T     Allow binary to be traceable [no]&lt;br /&gt;
     -C     Display license and exit&lt;br /&gt;
     -A     Display abstract and exit&lt;br /&gt;
     -h     Display help and exit&lt;br /&gt;
 &lt;br /&gt;
     Environment variables used:&lt;br /&gt;
     Name    Default  Usage&lt;br /&gt;
     CC      cc       C compiler command&lt;br /&gt;
     CFLAGS     C compiler flags&lt;br /&gt;
 &lt;br /&gt;
     Please consult the shc(1) man page.&lt;br /&gt;
 &lt;br /&gt;
Для проверки накидаем скрипт script.sh в пару строк:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 echo $1&lt;br /&gt;
&lt;br /&gt;
Скрипт просто выводит строку, переданную ему в качестве параметра&lt;br /&gt;
&lt;br /&gt;
 root@debian8:~/shc-3.8.9b # ./script.sh testing&lt;br /&gt;
 testing&lt;br /&gt;
&lt;br /&gt;
Теперь скомпилируем бинарный файл.&lt;br /&gt;
&lt;br /&gt;
 root@debian8:~/shc-3.8.9b # ./shc -r -T -f ./script.sh&lt;br /&gt;
&lt;br /&gt;
На выходе получаем 2 новых файла: script.sh.x - двоичный исполняемый файл script.sh.x.c - С код полученный из bash скрипта, при желании его можно подправить руками и скомпилировать штатными средствами системы. Проверяем бинарник:&lt;br /&gt;
&lt;br /&gt;
 root@debian8:~/shc-3.8.9b # ./script.sh.x &amp;quot;binary file&amp;quot;&lt;br /&gt;
 binary file&lt;br /&gt;
&lt;br /&gt;
Использовать полученный бинарник можно практически на любой версии linux. Скрипту можно установить срок годности (опция -e), по истечение которого файл будет выдавать сообщение (опция -m). &lt;br /&gt;
&lt;br /&gt;
ИСТОЧНИК:&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
* [https://vds-admin.ru/linux/%D0%BA%D0%B0%D0%BA-%D1%81%D0%B4%D0%B5%D0%BB%D0%B0%D1%82%D1%8C-%D0%B1%D0%B8%D0%BD%D0%B0%D1%80%D0%BD%D0%B8%D0%BA-%D0%B8%D0%B7-bash-%D1%81%D0%BA%D1%80%D0%B8%D0%BF%D1%82%D0%B0 Как сделать бинарник из bash скрипта]&lt;/div&gt;</summary>
		<author><name>imported&gt;Vix</name></author>
	</entry>
</feed>