Reputation: 2023
I'm trying to execute some commands from inside gnuplot, but I'm getting error. As far as I understand I should use "!" before command. Here is my script:
echo "
set terminal dumb
!OUT=$(adb shell dumpsys meminfo $PID | grep TOTAL )
!OUT=$(echo $OUT | sed -r 's/ +/ /g' | cut -d ' ' -f 2-)
!echo $OUT >> adbmon.log
plot 'adbmon.log' using 1:6 title 'Free'
" > sample.gp && gnuplot sample.gp
What am I doing wrong? Thank you for your time!
Upvotes: 0
Views: 1141
Reputation: 48390
For every !
a new shell is spawned, so that the variable $OUT
is not available in the second call. You can also plot everything on-the-fly as follows:
gnuplot -persist -e "set terminal dumb; plot '< adb shell dumpsys meminfo $PID | grep TOTAL | sed -r ''s/ +/ /g'' | cut -d '' '' -f 2-' using 1:6"
Upvotes: 1