Script not working when evoked by udev rule
<p>I am a Linux Mint user and I am trying to write a rule, that execute a script when I plug in the usb. The <code>#!/bin/sh script</code>, does not succeed 
to access the USB (even with a normal cd) while if I run the same 
script from command line, it works perfectly.</p>

<p>The rule I created for that purpose is:</p>

<pre><code>ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="058f", ATTR{idProduct}=="6387", RUN+=="/home/dario/bin/backup_usb"
</code></pre>

<p>where the backup_usb for instance looks like:</p>

<pre><code>#!/bin/sh
sleep 10
cd /media/dario/ 
echo " I am now in: $(pwd)" &gt;&gt; /home/dario/bin/log.log
cd /media/dario/DARIO_USB/  # That's the device just plugged in.
echo " I am now in: $(pwd)" &gt;&gt; /home/dario/bin/log.log
</code></pre>

<p>The output is:</p>

<pre><code>I am now in: /media/dario/ 
and now in: /
</code></pre>

<p>while I was expecting:</p>

<pre><code>I am now in: /media/dario/ 
and now in: /media/dario/DARIO_USB/
</code></pre>

<p>I would be very grateful for any help.</p>

<p>(This is the edited version of my question)</p>