ponysay/pages/ponysay/Narcissistic-ponies.html
Mattias Andrée f3e87096b0 sync manual
Signed-off-by: Mattias Andrée <maandree@operamail.com>
2013-04-05 09:58:33 +02:00

101 lines
4.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for ponysay
(version 3.0.1).
Copyright (C) 2012, 2013 Mattias Andrée
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled
"GNU Free Documentation License". -->
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Ponysay: Narcissistic ponies</title>
<meta name="description" content="Ponysay: Narcissistic ponies">
<meta name="keywords" content="Ponysay: Narcissistic ponies">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-and-program-index.html#Concept-and-program-index" rel="index" title="Concept and program index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Advanced-usage.html#Advanced-usage" rel="up" title="Advanced usage">
<link href="Environment-variables.html#Environment-variables" rel="next" title="Environment variables">
<link href="_007e_002f_002eponysayrc.html#g_t_007e_002f_002eponysayrc" rel="previous" title="~/.ponysayrc">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="../../info.css"></head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Narcissistic-ponies"></a>
<div class="header">
<p>
Previous: <a href="_007e_002f_002eponysayrc.html#g_t_007e_002f_002eponysayrc" accesskey="p" rel="previous">~/.ponysayrc</a>, Up: <a href="Advanced-usage.html#Advanced-usage" accesskey="u" rel="up">Advanced usage</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-and-program-index.html#Concept-and-program-index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Narcissistic-ponies-1"></a>
<h3 class="section">3.7 Narcissistic ponies</h3>
<a name="index-narcissistic-ponies"></a>
<p>The following will not work if you have line breaks in you file names, but if you do
have that, you may want to rethink that as it will usually cause problems for programs,
especially for shell scripts.
</p>
<p>The command <code>__pony=$(ponysay -o 3&gt;&amp;1 1&gt;/dev/null | grep ^pony\ file: |
sed -e s/^pony\ file:\ //g) &amp;&amp; (ponysay -of &quot;$__pony&quot; | ponythink -Wn -f &quot;$__pony&quot;)</code>
will give you a pony thinking of herself. The command works on GNU Bash, but may
not work on less POSIX compatible shells. It works by first getting a random pony and
use the extra information printed the file descriptor 3 (see <a href="Extra-information.html#Extra-information">Extra information</a>),
and fetchs the file name with help of <code>grep</code> and <code>sed</code>. The file
name is stored in a shell variable. It the pipes one an execute of ponysay into
another executing, using the stored file anme in both executions. This does not
work on FISH shell because os POSIX incompatibility.
</p>
<p>Ponysay can use just about anything as a message because it quarantines the message&rsquo;s
ANSI escape sequences, including colour. And is Unicode aware (including combining
characters) and ANSI escape sequence aware.
</p>
<p>Naturally this means that you can also make ponies think of eachother,
for example: <code>ponysay -f rarity -b round 'My little Spiky-wiky' |
ponythink -f spikefloat -b unicode -W n</code>
</p>
</body>
</html>