[clug] Bash questions...

Duncan Roe duncan_roe at acslink.net.au
Sat Apr 30 20:47:18 MDT 2011


On Sun, May 01, 2011 at 12:43:06PM +1000, Duncan Roe wrote:
> Interesting ... I get dashes plus spaces:
>
> 12:29:16$ echo $(yes '-' | head -n20)
> - - - - - - - - - - - - - - - - - - - -
> 12:31:04$ echo $(yes -| head -n20)
> - - - - - - - - - - - - - - - - - - - -
>
> sed doesn't seem to help:
> 12:33:17$ echo $(yes -|head -n20|sed 's/ //g')
> - - - - - - - - - - - - - - - - - - - -
>
> This works though:
> 12:39:40$ echo $(echo $(yes -|head -n20)|sed 's/ //g')
> --------------------

So does this
12:43:14$ echo $(yes -|head -n20|tr -d '\n')
--------------------

Cheers ... Duncan
>
> On Sun, May 01, 2011 at 12:23:14PM +1000, Francis Markham wrote:
> > Also, if you have "yes" installed you might want to try something like:
> >
> > echo $(yes '-' | head -n20)
> > >
> > >
> > Haven't tested this as I don't have bash on my Windows box at the moment.
> >
> > Cheers,
> >
> > -Francis
> >
> >
> >
> > On 1 May 2011 12:16, steve jenkin <sjenkin at canb.auug.org.au> wrote:
> >
> > > Thanks.
> > >
> > > Francis Markham wrote on 1/05/11 12:13 PM:
> > > > In python this is as simple as you would expect:
> > > >
> > > >     >>> print "-" * 20
> > > >     --------------------
> > > >
> > > > Cheers,
> > > >
> > > > -Francis
> > >
> > --
> > linux mailing list
> > linux at lists.samba.org
> > https://lists.samba.org/mailman/listinfo/linux
>
> --
>  Please avoid sending me Word or PowerPoint attachments.
>  See http://www.gnu.org/philosophy/no-word-attachments.html
> --
> linux mailing list
> linux at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux

--
 Please avoid sending me Word or PowerPoint attachments.
 See http://www.gnu.org/philosophy/no-word-attachments.html


More information about the linux mailing list