[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: echo -n
From: |
Greg Wooledge |
Subject: |
Re: echo -n |
Date: |
Thu, 2 Feb 2017 10:08:01 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Thu, Feb 02, 2017 at 02:32:00PM +0530, Sangamesh Mallayya wrote:
> in bash echo -n , echo -e , echo -E has a special meaning. But we do not
> have a way in bash shell if we want to print
> -n , -e and -E using echo command. Other shells supports printing of
> -n/-e/-E options using echo command.
Use printf instead of echo.
printf '%s\n' "$myvariable"
This will work regardless of the contents of the variable.
echo is deprecated, and should not be used unless you are certain that
it will not be given an argument that could be misinterpreted as an
option.
E.g. this is fine:
echo "You scored $points points."
This is not fine:
echo "$foo"
This was NEVER acceptable and you should not even THINK it:
echo $foo
- echo -n, Sangamesh Mallayya, 2017/02/02
- Re: echo -n, Eduardo Bustamante, 2017/02/02
- Re: echo -n,
Greg Wooledge <=
- Re: echo -n, Eric Blake, 2017/02/02
- Re: echo -n, John McKown, 2017/02/02
- Re: echo -n, Pierre Gaston, 2017/02/02
- Re: echo -n, Jyoti B Tenginakai, 2017/02/02
- Re: echo -n, Greg Wooledge, 2017/02/02
- Re: echo -n, John McKown, 2017/02/02
- Re: echo -n, Chet Ramey, 2017/02/02
- Re: echo -n, Jyoti B Tenginakai, 2017/02/05
- Re: echo -n, Clark Wang, 2017/02/06
- Re: echo -n, Peter & Kelly Passchier, 2017/02/06