1*cc145f5dSJilles Tjoelkerv=1234 2*cc145f5dSJilles Tjoelkerv=$v$v$v$v 3*cc145f5dSJilles Tjoelkerv=$v$v$v$v 4*cc145f5dSJilles Tjoelkerv=$v$v$v$v 5*cc145f5dSJilles Tjoelker#v=$v$v$v$v 6*cc145f5dSJilles Tjoelkerv=beginlong$v$v$v${v}endlong 7*cc145f5dSJilles Tjoelkerresult=$(ENV= HISTFILE=/dev/null script -q /dev/null ${SH} +m -i -o emacs <<EOF 8*cc145f5dSJilles Tjoelkerprintf '%s\n' "$v" 9*cc145f5dSJilles Tjoelkerprintf 'running %s\n' fc; fc -l 10*cc145f5dSJilles TjoelkerEOF 11*cc145f5dSJilles Tjoelker) 12*cc145f5dSJilles Tjoelkercase $result in 13*cc145f5dSJilles Tjoelker *'running fc'*beginlong*endlong*) ;; 14*cc145f5dSJilles Tjoelker *) 15*cc145f5dSJilles Tjoelker set -x 16*cc145f5dSJilles Tjoelker : result is "$result" 17*cc145f5dSJilles Tjoelker exit 2 18*cc145f5dSJilles Tjoelkeresac 19*cc145f5dSJilles Tjoelkerresult=${result#*running fc} 20*cc145f5dSJilles Tjoelkerresult=${result#*beginlong} 21*cc145f5dSJilles Tjoelkerresult=${result%endlong*} 22*cc145f5dSJilles Tjoelkerreflected=beginlong${result}endlong 23*cc145f5dSJilles Tjoelkerif [ "$v" != "$reflected" ]; then 24*cc145f5dSJilles Tjoelker set -x 25*cc145f5dSJilles Tjoelker : expected "$v" reflected "$reflected" 26*cc145f5dSJilles Tjoelker exit 3 27*cc145f5dSJilles Tjoelkerfi 28