I have a script that merges two normal maps, but I want it to be a single line. How to change it?
This is the working script:
```
IN1=$1
IN2=$2
OUT=${3:-'merged.png'}
CLEARMETA=${4:-'1'}
CLEARMETACOMMAND=-strip
EXT=miff
TEMP_DIR=$(mktemp -d)

# The base image may have meta data that you do not want, like a thumbnail.
# Pass 0 as the fouth parameter to keep the metadata.
if [ "$CLEARMETA" = "0" ] ;then
    CLEARMETACOMMAND=""
fi

#convert "$IN" -fx R in_channel_R.$EXT
#convert "$IN" -fx G in_channel_G.$EXT
#convert "$IN" -fx B in_channel_B.$EXT

#convert "$IN" -channel B +level 0,0 -channel R -level 50%,100%,0.5 +channel G -level 50%,100%,0.5 add1.$EXT
# -level does Input Levels
# +level does Output Levels
convert "$IN2" -channel B +level 0,0 -channel R -level 50%,100% +level 50%,100% -channel G -level 50%,100% +level 50%,100% $TEMP_DIR/add1.$EXT
convert "$IN2" -channel R -level 0%,50% +level 0%,50% -channel G -level 0%,50% +level 0%,50% $TEMP_DIR/sub1.$EXT

convert $TEMP_DIR/sub1.$EXT -color-matrix " \
-1 0 0 0, 0, 0.5 \
0 -1 0 0, 0, 0.5 \
0 0 -1 0, 0, 1 \
0 0  0 0, 0, 0 \
0 0  0 0, 0, 0 \
0 0  0 0, 0, 0" \
$TEMP_DIR/sub2.$EXT

convert $TEMP_DIR/add1.$EXT -color-matrix " \
1 0 0 0, 0, -0.5 \
0 1 0 0, 0, -0.5 \
0 0 0 0, 0, 0 \
0 0 0 0, 0, 0 \
0 0 0 0, 0, 0 \
0 0 0 0, 0, 0" \
$TEMP_DIR/add2.$EXT


#convert sub2.$EXT "$IN1" -compose subtract -composite test1.$EXT
#convert add2.$EXT test1.$EXT -compose linearDodge -composite test2.$EXT

#convert sub2.$EXT "$IN1" -compose subtract -composite add2.$EXT -compose linearDodge -composite test3.$EXT

convert $TEMP_DIR/sub2.$EXT -channel Red,Green -separate -background black -combine +channel $TEMP_DIR/subRG.$EXT
convert $TEMP_DIR/sub2.$EXT -channel Blue -separate -background black -combine +channel $TEMP_DIR/subB.$EXT

convert $TEMP_DIR/subRG.$EXT "$IN1" -compose difference -composite $TEMP_DIR/subB.$EXT -compose exclusion -composite $TEMP_DIR/add2.$EXT -compose linearDodge -composite $CLEARMETACOMMAND $OUT

rm -R ${TEMP_DIR}
```
This is an attempt to make it a single line, but it does not quite work properly (everything looks too green):
```
IN1=$1
IN2=$2
OUT=${3:-'merged.png'}
CLEARMETA=${4:-'1'}
CLEARMETACOMMAND=-strip

convert "$IN2" +write mpr:in2 +delete \
\( mpr:in2 \
    -channel R -level 0%,50% +level 0%,50% \
    -channel G -level 0%,50% +level 0%,50% \
    -color-matrix " \
    -1 0 0 0, 0, 0.5 \
    0 -1 0 0, 0, 0.5 \
    0 0 -1 0, 0, 1 \
    0 0  0 0, 0, 0 \
    0 0  0 0, 0, 0 \
    0 0  0 0, 0, 0" \
    -write mpr:sub2 +delete \) \
\( mpr:sub2 \
    -channel Red,Green -separate -background black \
    -combine +channel +write mpr:subRG +delete \) \
\( mpr:sub2 \
    -channel Blue -separate -background black \
    -combine +channel +write mpr:subB +delete \) \
\( mpr:in2 \
    -channel B +level 0,0 \
    -channel R -level 50%,100% +level 50%,100% \
    -channel G -level 50%,100% +level 50%,100% \
    -color-matrix " \
    1 0 0 0, 0, -0.5 \
    0 1 0 0, 0, -0.5 \
    0 0 0 0, 0, 0 \
    0 0 0 0, 0, 0 \
    0 0 0 0, 0, 0 \
    0 0 0 0, 0, 0" \
    +write mpr:add2 +delete \) \
mpr:subRG "$IN1" -compose difference -composite \
    mpr:subB -compose exclusion -composite \
    mpr:add2 -compose linearDodge -composite \
$OUT
```