19ddb49cbSWarner Losh.\"- 24b88c807SRodney W. Grimes.\" Copyright (c) 1990, 1993 34b88c807SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 44b88c807SRodney W. Grimes.\" 54b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 64b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 74b88c807SRodney W. Grimes.\" 84b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 94b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions 104b88c807SRodney W. Grimes.\" are met: 114b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 124b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 134b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 144b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 154b88c807SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 16fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 174b88c807SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 184b88c807SRodney W. Grimes.\" without specific prior written permission. 194b88c807SRodney W. Grimes.\" 204b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 214b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234b88c807SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 244b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304b88c807SRodney W. Grimes.\" SUCH DAMAGE. 314b88c807SRodney W. Grimes.\" 321e73a8c1SSevan Janiyan.Dd October 5, 2016 334b88c807SRodney W. Grimes.Dt ECHO 1 344b88c807SRodney W. Grimes.Os 354b88c807SRodney W. Grimes.Sh NAME 364b88c807SRodney W. Grimes.Nm echo 374b88c807SRodney W. Grimes.Nd write arguments to the standard output 384b88c807SRodney W. Grimes.Sh SYNOPSIS 39be8b1497SRuslan Ermilov.Nm 404b88c807SRodney W. Grimes.Op Fl n 41d0353b83SRuslan Ermilov.Op Ar string ... 424b88c807SRodney W. Grimes.Sh DESCRIPTION 434b88c807SRodney W. GrimesThe 4495d0bf65SPhilippe Charnier.Nm 45d0353b83SRuslan Ermilovutility writes any specified operands, separated by single blank 46d0353b83SRuslan Ermilov.Pq Ql "\ " 47d0353b83SRuslan Ermilovcharacters and followed by a newline 48d0353b83SRuslan Ermilov.Pq Ql \en 49d0353b83SRuslan Ermilovcharacter, to the standard 504b88c807SRodney W. Grimesoutput. 514b88c807SRodney W. Grimes.Pp 524b88c807SRodney W. GrimesThe following option is available: 534b88c807SRodney W. Grimes.Bl -tag -width flag 544b88c807SRodney W. Grimes.It Fl n 55005fd5b6SJens SchweikhardtDo not print the trailing newline character. 5661aad2feSJilles Tjoelker.El 5761aad2feSJilles Tjoelker.Pp 5861aad2feSJilles TjoelkerThe end-of-options marker 5961aad2feSJilles Tjoelker.Fl Fl 6061aad2feSJilles Tjoelkeris not recognized and written literally. 6161aad2feSJilles Tjoelker.Pp 6261aad2feSJilles TjoelkerThe newline may also be suppressed by appending 63d0353b83SRuslan Ermilov.Ql \ec 64d0353b83SRuslan Ermilovto the end of the string, as is done 656cef43a7SJordan K. Hubbardby iBCS2 compatible systems. 6661aad2feSJilles TjoelkerNote that the 6761aad2feSJilles Tjoelker.Fl n 6861aad2feSJilles Tjoelkeroption as well as the effect of 69005fd5b6SJens Schweikhardt.Ql \ec 70005fd5b6SJens Schweikhardtare implementation-defined in 71005fd5b6SJens Schweikhardt.St -p1003.1-2001 72eccea571SRuslan Ermilovas amended by Cor.\& 1-2002. 7361aad2feSJilles TjoelkerFor portability, 74c644db6aSSheldon Hearn.Nm 7561aad2feSJilles Tjoelkershould only be used if the first argument does not start with a hyphen 7661aad2feSJilles Tjoelker.Pq Ql "-" 7761aad2feSJilles Tjoelkerand does not contain any backslashes 7861aad2feSJilles Tjoelker.Pq Ql "\e" . 7961aad2feSJilles TjoelkerIf this is not sufficient, 8061aad2feSJilles Tjoelker.Xr printf 1 8161aad2feSJilles Tjoelkershould be used. 8261aad2feSJilles Tjoelker.Pp 8361aad2feSJilles TjoelkerMost shells provide a builtin 8461aad2feSJilles Tjoelker.Nm 8561aad2feSJilles Tjoelkercommand which tends to differ from this utility 8661aad2feSJilles Tjoelkerin the treatment of options and backslashes. 87e6d3cf26SSheldon HearnConsult the 88c644db6aSSheldon Hearn.Xr builtin 1 89c644db6aSSheldon Hearnmanual page. 906fca4c7cSRuslan Ermilov.Sh EXIT STATUS 91d628d776SRuslan Ermilov.Ex -std 927e689764SFernando Apesteguía.Sh EXAMPLES 937e689764SFernando ApesteguíaSpecial treatment of options and backslashes: 947e689764SFernando Apesteguía.Bd -literal -offset indent 957e689764SFernando Apesteguía$ /bin/echo "-hello\\tworld" 967e689764SFernando Apesteguía-hello\tworld 977e689764SFernando Apesteguía.Ed 987e689764SFernando Apesteguía.Pp 997e689764SFernando ApesteguíaAvoid new line character: 1007e689764SFernando Apesteguía.Bd -literal -offset indent 1017e689764SFernando Apesteguía$ /bin/echo -n hello;/bin/echo world 1027e689764SFernando Apesteguíahelloworld 1037e689764SFernando Apesteguía.Ed 1047e689764SFernando Apesteguía.Pp 1057e689764SFernando ApesteguíaOr to achieve the same result: 1067e689764SFernando Apesteguía.Bd -literal -offset indent 1077e689764SFernando Apesteguía$ /bin/echo "hello\\c";/bin/echo world 1087e689764SFernando Apesteguíahelloworld 1097e689764SFernando Apesteguía.Ed 1104b88c807SRodney W. Grimes.Sh SEE ALSO 111c644db6aSSheldon Hearn.Xr builtin 1 , 112c644db6aSSheldon Hearn.Xr csh 1 , 113c644db6aSSheldon Hearn.Xr printf 1 , 114c644db6aSSheldon Hearn.Xr sh 1 1154b88c807SRodney W. Grimes.Sh STANDARDS 1164b88c807SRodney W. GrimesThe 11795d0bf65SPhilippe Charnier.Nm 11888d5eb71STim J. Robbinsutility conforms to 11988d5eb71STim J. Robbins.St -p1003.1-2001 120eccea571SRuslan Ermilovas amended by Cor.\& 1-2002. 1211e73a8c1SSevan Janiyan.Sh HISTORY 1221e73a8c1SSevan JaniyanThe 1231e73a8c1SSevan Janiyan.Nm 1241e73a8c1SSevan Janiyancommand appeared in 1251e73a8c1SSevan Janiyan.At v2 . 1267e689764SFernando Apesteguía.Sh CAVEATS 1277e689764SFernando ApesteguíaThe 1287e689764SFernando Apesteguía.Nm 1297e689764SFernando Apesteguíacommand behaves differently with regards to the built-in 1307e689764SFernando Apesteguía.Nm 1317e689764SFernando Apesteguíashell command in a number of ways including escaped characters handling. 1327e689764SFernando ApesteguíaIt also differs in behavior between different systems hence complicating writing 1337e689764SFernando Apesteguíaportable scripts. 1347e689764SFernando ApesteguíaIt is advised to use the 1357e689764SFernando Apesteguía.Xr printf 1 1367e689764SFernando Apesteguíacommand to avoid these shortcomings. 137