multiplexor4.sh 511 Bytes
#!/bin/bash

INPUT="$1"

A=`echo "$INPUT" | cut -d',' -f 1`
B=`echo "$INPUT" | cut -d',' -f 2`
C=`echo "$INPUT" | cut -d',' -f 3`
D=`echo "$INPUT" | cut -d',' -f 4`
S=`echo "$INPUT" | cut -d',' -f 5`

S1=`echo "$S" | cut -b1`
S2=`echo "$S" | cut -b2`

N1=`./not $S1,`
N2=`./not $S2,`
N3=`./and $D,$S1,`
N4=`./and $C,$N1,`
N5=`./and $B,$S1,`
N6=`./and $A,$N1,`
N7=`./and $N3,$S2,`
N8=`./and $N4,$S2,`
N9=`./and $N5,$N2,`
N10=`./and $N6,$N2,`
N11=`./or $N7,$N8,`
N12=`./or $N9,$N10,`
Z=`./or $N11,$N12,`

echo $Z