[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Is there a way to pipe heredoc with another command?
From: |
konsolebox |
Subject: |
Re: [Help-bash] Is there a way to pipe heredoc with another command? |
Date: |
Fri, 25 Dec 2015 23:55:56 +0800 |
On Fri, Dec 25, 2015 at 11:49 PM, Peng Yu <address@hidden> wrote:
> For example, I want to pipe the following cat (with heredoc) with
> another command. I am wondering whether there is a bahs syntax to pipe
> a command with heredoc and another command. Thanks.
>
> cat << EOF
> a
> b
> c
> EOF
> | xargs -0 -n 1 echo "VALUE:"
>
One way is to group them:
{
cat << EOF
a
b
c
EOF
} | xargs -0 -n 1 echo "VALUE:"
Or just use here strings.