<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Linux Forum &mdash; Как заставить команду echo выводить в цвете?]]></title>
	<link rel="self" href="https://linuxforum.ru/extern.php?action=feed&amp;tid=12150&amp;type=atom" />
	<updated>2011-03-25T06:59:35Z</updated>
	<generator>PunBB</generator>
	<id>https://linuxforum.ru/viewtopic.php?id=12150</id>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=160325#p160325" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Ciber SLasH пишет:</cite><blockquote><p>И bash я не использую, пока всё по умолчанию. И к чему этот сарказм не понятно. Люди задают вопросы, потому, что они не смогли сами найти ответ в кратчайшие сроки. Почему нельзя просто ответить по-дружески</p></blockquote></div><p>да я как-бы не просто написал RTFM, а указал точное название FM, и даже процитировал строчки из него. Причём как раз те, что дают вам ответ на ваш вопрос. Уж извините, забыл что во фряхе по дефолту csh. Используйте bash - делов-то? ЕМНИП во фряхе он есть, а стало-быть достаточно просто выполнить<br />/bin/bash<br />и всё получится. <img src="https://linuxforum.ru/img/smilies/bx.gif" alt="bx" /><br /></p><div class="quotebox"><cite>Ciber SLasH пишет:</cite><blockquote><p>благодаря сарказму drBatty я догадался почитать ман по csh и там нашёл следующее:</p></blockquote></div><p>ну вот видите? а написал-бы я просто строчку, вы-бы так ничего и не поняли. Вот на винфаке я-бы так и сделал - просто-бы дал готовое решение. Но мы не на винфаке, и я даю вам нечто большее - МЕТОД. Как видите, мой метод работает, и позволяет решить проблему в любой *NIX системе.<br /></p><div class="quotebox"><cite>Ciber SLasH пишет:</cite><blockquote><p>both, the default - получается both нифига не дефолт.</p></blockquote></div><p>не. раз написано дефолт - значит дефолт. Посмотрите в /etc/rc.d/ стартовые скрипты - наверняка там изменено поведение по умолчанию. Кроме того, оно может меняться при логине.<br /></p><div class="quotebox"><cite>man csh пишет:</cite><blockquote><p>&nbsp; &nbsp;Startup and shutdown<br />&nbsp; &nbsp; &nbsp; &nbsp;A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login.&nbsp; &nbsp;It&nbsp; then<br />&nbsp; &nbsp; &nbsp; &nbsp;executes&nbsp; commands from files in the user&#039;s home directory: first ~/.tcshrc (+) or, if ~/.tcshrc is not found,<br />&nbsp; &nbsp; &nbsp; &nbsp;~/.cshrc, then ~/.history (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs<br />&nbsp; &nbsp; &nbsp; &nbsp;(or&nbsp; the value of the dirsfile shell variable) (+).&nbsp; The shell may read /etc/csh.login before instead of after<br />&nbsp; &nbsp; &nbsp; &nbsp;/etc/csh.cshrc, and ~/.login before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so compiled; see<br />&nbsp; &nbsp; &nbsp; &nbsp;the version shell variable. (+)</p></blockquote></div><div class="quotebox"><cite>zhevak пишет:</cite><blockquote><p>Дмитрий, все хочу задать Вам вопрос и все как-то не получалось...</p></blockquote></div><p>у меня всё хорошо. <img src="https://linuxforum.ru/img/smilies/bx.gif" alt="bx" /><br />чё-то злой был...<br />ну хочет человек быстрой помощи, сложно в мане слеш набрать?<br /></p><div class="quotebox"><cite>zhevak пишет:</cite><blockquote><p>Но он так периодически сдуривает. И это тоже факт. Печальный факт.<br />Так что примите наши извинения, а в следующий раз делайте скидочку на неполноценность Дока. Он парень башковитый, но дурак. Что делать. Это не лечиться. Приходится терпеть его закидоны.</p></blockquote></div><p>спасибо <img src="https://linuxforum.ru/img/smilies/bx.gif" alt="bx" /><br />пойду плюсану что-ли</p>]]></content>
			<author>
				<name><![CDATA[drBatty]]></name>
				<uri>https://linuxforum.ru/profile.php?id=86</uri>
			</author>
			<updated>2011-03-25T06:59:35Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=160325#p160325</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=160250#p160250" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Ciber SLasH пишет:</cite><blockquote><p><strong>drBatty</strong>, религия здесь не причём. Ман по команде <em>echo</em> читал. Вот только не догадался, почитать ман про <em>csh</em>.<br />И <em>bash</em> я не использую, пока всё по умолчанию. И к чему этот сарказм не понятно. Люди задают вопросы, потому, что они не смогли сами найти ответ в кратчайшие сроки. Почему нельзя просто ответить по-дружески, дать направление, ссылку а не сразу указывать новичкам на их ламерство. Все когда-то были ламерами в чём-то. Я могу разбираться в чём-то лучше кого-то, но я не говорю никому тупо RTFM и не возвышаю себя над другими.</p></blockquote></div><p>Вы, судя по количеству сообщений, -- новичек на нашем форуме. Не обращайте на DrBatty много внимания. У него мозги варят, это факт. Но он так периодически сдуривает. И это тоже факт. Печальный факт.<br />Так что примите наши извинения, а в следующий раз делайте скидочку на неполноценность Дока. Он парень башковитый, но дурак. Что делать. Это не лечиться. Приходится терпеть его закидоны.</p>]]></content>
			<author>
				<name><![CDATA[zhevak]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9718</uri>
			</author>
			<updated>2011-03-24T20:12:55Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=160250#p160250</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=160244#p160244" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>drBatty пишет:</cite><blockquote><p>скажите, ваша религия запрещает читать маны?<br />тогда на винфак пожалуйста.</p></blockquote></div><p>Дмитрий, все хочу задать Вам вопрос и все как-то не получалось...</p><p>У Вас мама был? Папа был? А почему злой как собака?</p>]]></content>
			<author>
				<name><![CDATA[zhevak]]></name>
				<uri>https://linuxforum.ru/profile.php?id=9718</uri>
			</author>
			<updated>2011-03-24T20:05:25Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=160244#p160244</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=160211#p160211" />
			<content type="html"><![CDATA[<p><strong>drBatty</strong>, религия здесь не причём. Ман по команде <em>echo</em> читал. Вот только не догадался, почитать ман про <em>csh</em>.<br />И <em>bash</em> я не использую, пока всё по умолчанию. И к чему этот сарказм не понятно. Люди задают вопросы, потому, что они не смогли сами найти ответ в кратчайшие сроки. Почему нельзя просто ответить по-дружески, дать направление, ссылку а не сразу указывать новичкам на их ламерство. Все когда-то были ламерами в чём-то. Я могу разбираться в чём-то лучше кого-то, но я не говорю никому тупо RTFM и не возвышаю себя над другими.</p><p><strong>Remedy</strong>, благодаря сарказму <strong>drBatty</strong> я догадался почитать ман по <em>csh</em> и там нашёл следующее:<br /></p><div class="quotebox"><blockquote><p>Special shell variables<br />echo_style (+)<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; The style of the echo builtin.&nbsp; May be set to</p><p>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; bsd&nbsp; &nbsp; &nbsp;Don&#039;t echo a newline if the first argument is `-n&#039;.<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; sysv&nbsp; &nbsp; Recognize backslashed escape sequences in echo strings.<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; both&nbsp; &nbsp; Recognize&nbsp; both&nbsp; &nbsp; the&nbsp; `-n&#039;&nbsp; flag and backslashed escape<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; sequences; the default.<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; none&nbsp; &nbsp; Recognize neither.</p><p>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; Set by default to the local system default.&nbsp; The BSD and System<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; V&nbsp; options are described in the echo(1) man pages on the appro-<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; priate systems.</p></blockquote></div><p>вставил в <em>~/.cshrc</em> строку <em>set echo_style = both</em><br />и цвет появился. Хотя, как сказано в мане про <em>echo_style: both, the default</em> - получается <em>both</em> нифига не дефолт.<br />Только бэкслеши нужно экранировать, т.е. комнда выглядит так:<br /></p><div class="codebox"><pre><code>echo \\e[31m Hello! \\033[0m</code></pre></div><p>ЗЫ: \e и \033 - одно и тоже</p>]]></content>
			<author>
				<name><![CDATA[Ciber SLasH]]></name>
				<uri>https://linuxforum.ru/profile.php?id=16076</uri>
			</author>
			<updated>2011-03-24T19:16:46Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=160211#p160211</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=159924#p159924" />
			<content type="html"><![CDATA[<p><strong>drBatty</strong>, это же фряха!<br /><strong>Ciber SLasH</strong>, дело в том, что используемый в FreeBSD по умолчанию шелл <strong>csh</strong> не умеет &quot;раскрашивать&quot; вывод echo, зато это умеет <strong>bash</strong>, которым привык пользоваться я, например. Потому у меня вывод получился цветным, а у Вас остался ч/б.</p>]]></content>
			<author>
				<name><![CDATA[Remedy]]></name>
				<uri>https://linuxforum.ru/profile.php?id=13291</uri>
			</author>
			<updated>2011-03-24T09:31:53Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=159924#p159924</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=159870#p159870" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Ciber SLasH пишет:</cite><blockquote><p>Подскажите пожалуйста, почему следующая команда не выводится в цвете?</p></blockquote></div><div class="quotebox"><cite>man bash пишет:</cite><blockquote><p>&nbsp; &nbsp; &nbsp; &nbsp;echo-control-characters (On)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; When&nbsp; set to On, on operating systems that indicate they support it, readline echoes a character corre‐<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sponding to a signal generated from the keyboard.<br />&lt;skip&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp;echo [-neE] [arg ...]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Output the args, separated by spaces, followed by a newline.&nbsp; The return status is always 0.&nbsp; If -n&nbsp; is<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; specified,&nbsp; the&nbsp; trailing newline is suppressed.&nbsp; If the -e option is given, interpretation of the fol‐<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lowing backslash-escaped characters is enabled.&nbsp; The -E option disables&nbsp; the&nbsp; interpretation&nbsp; of&nbsp; these<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; escape&nbsp; characters,&nbsp; even&nbsp; on systems where they are interpreted by default.&nbsp; The xpg_echo shell option<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; may be used to dynamically determine whether or not echo expands these escape&nbsp; characters&nbsp; by&nbsp; default.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo does not interpret -- to mean the end of options.&nbsp; echo interprets the following escape sequences:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \a&nbsp; &nbsp; &nbsp;alert (bell)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \b&nbsp; &nbsp; &nbsp;backspace<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \c&nbsp; &nbsp; &nbsp;suppress further output<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \e&nbsp; &nbsp; &nbsp;an escape character<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \f&nbsp; &nbsp; &nbsp;form feed<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n&nbsp; &nbsp; &nbsp;new line<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \r&nbsp; &nbsp; &nbsp;carriage return<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \t&nbsp; &nbsp; &nbsp;horizontal tab<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \v&nbsp; &nbsp; &nbsp;vertical tab<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \\&nbsp; &nbsp; &nbsp;backslash<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \0nnn&nbsp; the eight-bit character whose value is the octal value nnn (zero to three octal digits)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \xHH&nbsp; &nbsp;the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)</p></blockquote></div><p>скажите, ваша религия запрещает читать маны?<br />тогда на винфак пожалуйста.</p>]]></content>
			<author>
				<name><![CDATA[drBatty]]></name>
				<uri>https://linuxforum.ru/profile.php?id=86</uri>
			</author>
			<updated>2011-03-24T06:56:15Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=159870#p159870</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=159850#p159850" />
			<content type="html"><![CDATA[<p>Так тоже ч\б цвет.</p>]]></content>
			<author>
				<name><![CDATA[Ciber SLasH]]></name>
				<uri>https://linuxforum.ru/profile.php?id=16076</uri>
			</author>
			<updated>2011-03-24T06:01:54Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=159850#p159850</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=159794#p159794" />
			<content type="html"><![CDATA[<p>А так? <img src="https://linuxforum.ru/img/smilies/ab.gif" alt="ab" /><div class="termtitle" style="font-family: sans-serif; position:relative; height:auto; width:auto; background:#3A4061; color:#FFFFFF; padding: 1px;"><b> Консоль:</b></div>
<div class="termcont" style="font-family: Terminus; position:relative; height:auto; width:auto; overflow-x:scroll; white-space: nowrap ; overflow-y:auto;background:#000000; color:#4EF44E; line-height:1.2; padding: 3px; font-size: 1rem; max-height: 60vh">echo -e &quot;\033[31m&quot; HELLO!</div></p>]]></content>
			<author>
				<name><![CDATA[Remedy]]></name>
				<uri>https://linuxforum.ru/profile.php?id=13291</uri>
			</author>
			<updated>2011-03-23T22:51:11Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=159794#p159794</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Как заставить команду echo выводить в цвете?]]></title>
			<link rel="alternate" href="https://linuxforum.ru/viewtopic.php?pid=159778#p159778" />
			<content type="html"><![CDATA[<p>Приветствую всех!<br />Подскажите пожалуйста, почему следующая команда не выводится в цвете?<br /></p><div class="codebox"><pre><code>echo &quot;\033[31m HELLO!&quot;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Ciber SLasH]]></name>
				<uri>https://linuxforum.ru/profile.php?id=16076</uri>
			</author>
			<updated>2011-03-23T21:22:57Z</updated>
			<id>https://linuxforum.ru/viewtopic.php?pid=159778#p159778</id>
		</entry>
</feed>
