开发者

bash inner script ?inline? passing to interpreters new lines problem

I have some bas开发者_运维知识库h script:

#!/bin/bash
INTERPRETER=/home/user/bin/inter
TASKSET=/bin/taskset
BACKUP=/home/user/backup
SCRIPT='action 1;
        action 2;
        if 1;
           do something;
           do something else;
        fi;
        if 2; do something; do something else; fi;
        lambda1 {
           do something;
           do something;
           };
        lamda2 {do....};
        exit 0;'
echo -e `$TASKSET -c 1,2 $INTERPRETER <<< "$SCRIPT"`

Problem is that formatted if 1 and lambda1 throws an error.

Flattened if2 and lamda2 works fine.

  1. Is there an option to fix that new liners?
  2. How this function '<<<' is called, what to look up in uncle google?

EDIT

echo -e "$SCRIPT" | $TASKSET.....

behaves this same wrong way.


The other general form of a here string (aka here document) is

<<word

an example of this form is:

cat <<EOF
This is some text that I want to pass to cat
EOF

In this format of the here doument, no expansion or substitution is performed.

What language is /home/user/bin/inter interpreting? How does that interpreter react to linefeeds and escaped linefeeds?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜