<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[trouble using [shell] object with bash script]]></title><description><![CDATA[<p>Hi there, hope someone can help.</p>
<p>I'm trying to run a bash script together with Pd and am having some issues.</p>
<p>Brief overview: the bash script sends iwlist data every 0.5 secs via UDP to Pd.  This works fine when launched from the GUI - the script runs, sends packets of info to Pd constantly for Pd to play with, and stops when I tell it to.</p>
<p>I'm trying to automate the process into a single script from command line, launching Pd with nogui.    For some reason when I do this, the scanning script runs fine, but only the first scan packet gets to Pd - after that, the scan keeps going but the data isn't making it to Pd, though Pd is still running fine it appears.</p>
<p>I'm going to try using {shell} to run the scanning script from inside Pd instead, but so far whenever I try to call the script in a message to [shell], Pd crashes.  I can't find much help on how to use [shell] online, and hope there's some bash/Pd pros here who can shed some light on this issue.</p>
<p>Many thanks!</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script</link><generator>RSS for Node</generator><lastBuildDate>Sat, 15 Aug 2026 10:02:06 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/8552.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 Aug 2014 20:03:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to trouble using [shell] object with bash script on Sat, 09 Aug 2014 20:03:08 GMT]]></title><description><![CDATA[<p>Hi there, hope someone can help.</p>
<p>I'm trying to run a bash script together with Pd and am having some issues.</p>
<p>Brief overview: the bash script sends iwlist data every 0.5 secs via UDP to Pd.  This works fine when launched from the GUI - the script runs, sends packets of info to Pd constantly for Pd to play with, and stops when I tell it to.</p>
<p>I'm trying to automate the process into a single script from command line, launching Pd with nogui.    For some reason when I do this, the scanning script runs fine, but only the first scan packet gets to Pd - after that, the scan keeps going but the data isn't making it to Pd, though Pd is still running fine it appears.</p>
<p>I'm going to try using {shell} to run the scanning script from inside Pd instead, but so far whenever I try to call the script in a message to [shell], Pd crashes.  I can't find much help on how to use [shell] online, and hope there's some bash/Pd pros here who can shed some light on this issue.</p>
<p>Many thanks!</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script</guid><dc:creator><![CDATA[youcloudsofdoom]]></dc:creator><pubDate>Sat, 09 Aug 2014 20:03:08 GMT</pubDate></item><item><title><![CDATA[Reply to trouble using [shell] object with bash script on Mon, 11 Aug 2014 00:36:06 GMT]]></title><description><![CDATA[<p>No thoughts?  Let me know if there's anything I can add.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/2</guid><dc:creator><![CDATA[youcloudsofdoom]]></dc:creator><pubDate>Mon, 11 Aug 2014 00:36:06 GMT</pubDate></item><item><title><![CDATA[Reply to trouble using [shell] object with bash script on Sun, 17 Aug 2014 08:35:25 GMT]]></title><description><![CDATA[<p>Share the script? or the message?<br />
I'm really not sure if I can help, but it would definitely help people who know more about scripting and online stuff..</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/3</guid><dc:creator><![CDATA[alexandros]]></dc:creator><pubDate>Sun, 17 Aug 2014 08:35:25 GMT</pubDate></item><item><title><![CDATA[Reply to trouble using [shell] object with bash script on Mon, 18 Aug 2014 12:43:41 GMT]]></title><description><![CDATA[<p>Yeah, good idea Alexandros, thanks.</p>
<p>Here's the shell script:</p>
<pre><code>#!/bin/bash

NUM_BANKS=20

while [[ &quot;$input&quot; != &quot;\e&quot; ]] ; do

networks=$(iwlist wlan0 scanning | awk 'BEGIN{ FS=&quot;[:=]&quot;; OFS = &quot; &quot; }
/ESSID/{ 
    #gsub(/ /,&quot;\\ &quot;,$2)
    #gsub(/\&quot;/,&quot;&quot;,$2)
    essid[c++]=$2 
}
/Address/{
 gsub(/.*Address: /,&quot;&quot;) 
 address[a++]=$0
}
/Encryption key/{ encryption[d++]=$2 }
/Quality/{ 
gsub(/ dBm  /,&quot;&quot;)
signal[b++]=$3 
}
END {
for( c in essid ) { print &quot;/wlan_scan &quot;,essid[c],signal[c],encryption[c] }
}' 
)
read -t 0.3  input

echo &quot;$networks&quot; | while read network; do
set $network
hash=` echo &quot;$2&quot; | md5sum | awk '{ print $1 }'| tr '[:lower:]' '[:upper:]'` 
bank=`echo &quot;ibase=16;obase=A; $hash%$NUM_BANKS &quot; | bc`
echo &quot;$1$bank $2 $3 $4&quot;
echo &quot;$1$bank $2 $3 $4&quot; | sendOSC -h localhost 9997 
done

#echo &quot;$networks&quot; | sendOSC -h localhost 9997

done
</code></pre>
<p>This pipes into a Pd patch which reads the info from [udpreceive].</p>
<p>And this is the script I'm trying to make that automates the running of the Pd patch as well as the above scanning script:</p>
<pre><code>#!/bin/bash
pd-extended -nogui /home/pi/patch.pd &amp; sudo /home/pi/libOSC/scan.sh &amp;&amp; fg
</code></pre>
<p>As I said, what seems to be happening is that the first packet is received by Pd, but then none after that.  The scanning script is definitely still scanning and sending, but for some reason the packets aren't being received by Pd.</p>
<p>I hope this makes it clearer!</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/4</guid><dc:creator><![CDATA[youcloudsofdoom]]></dc:creator><pubDate>Mon, 18 Aug 2014 12:43:41 GMT</pubDate></item><item><title><![CDATA[Reply to trouble using [shell] object with bash script on Sun, 17 Aug 2014 16:58:32 GMT]]></title><description><![CDATA[<p>are you reveiving with [netreceive]?  the second Inlet sends an integer with the # of connections.  what does it say after the only message received?</p>
<p>as for crashing with -nogui:   how are the permissions set on your script?  that may affect how pd runs it w/o gui.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/5</guid><dc:creator><![CDATA[sunji]]></dc:creator><pubDate>Sun, 17 Aug 2014 16:58:32 GMT</pubDate></item><item><title><![CDATA[Reply to trouble using [shell] object with bash script on Wed, 20 Aug 2014 07:50:32 GMT]]></title><description><![CDATA[<p>I run the script with sudo, it won't execute properly without it.  Weirdly I replaced [udpreceive] with [dumpOSC] and the problem corrected itself - the issue is now that dumpOSC has a really noticeable lag compared to udpreceive (possibly one of the reasons it was retired!).  I'm going to try it with netrecieive and see what happens.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/6</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/6</guid><dc:creator><![CDATA[youcloudsofdoom]]></dc:creator><pubDate>Wed, 20 Aug 2014 07:50:32 GMT</pubDate></item><item><title><![CDATA[Reply to trouble using [shell] object with bash script on Wed, 20 Aug 2014 15:17:46 GMT]]></title><description><![CDATA[<p>[netreceive] can be set in udp server mode.  I've had some low latency success socketing udp with this method.  are you running pure data as superuser or are you feeding sudo your password?</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/7</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/8552/trouble-using-shell-object-with-bash-script/7</guid><dc:creator><![CDATA[sunji]]></dc:creator><pubDate>Wed, 20 Aug 2014 15:17:46 GMT</pubDate></item></channel></rss>