I'm trying to write a simple script that will take $# as an argument whenever a file is modified or created in a certain directory but I'm experiencing a very weird and inconsistent issue. I'll explain.
Let's put a file with tricky characters like ( and ) a very long name.txt inside ~/incron-test. As far as I understand so far and after some experiments, I realized I need to quote $# because otherwise ~/incron-test.sh won't understand it receives a single argument, correct me if I'm wrong so far.
Inside ~/incron-test.sh, put the following:
echo "$@" > ~/incron-test.log
There should be no problem with this test.
I'm trying to perform the exact same setup only with a different directory - /var/lib/mpd/playlists. As you may have guessed, this is the where all of mpd's playlists are saved. The problem appears when I edit a playlist from a client like ncmpcpp. Here is incrond's journal when I do so:
I'm trying to write a simple script that will take
$#
as an argument whenever a file is modified or created in a certain directory but I'm experiencing a very weird and inconsistent issue. I'll explain.Let's put the following in
incrontab
:Let's put
a file with tricky characters like ( and ) a very long name.txt
inside~/incron-test
. As far as I understand so far and after some experiments, I realized I need to quote$#
because otherwise~/incron-test.sh
won't understand it receives a single argument, correct me if I'm wrong so far.Inside
~/incron-test.sh
, put the following:There should be no problem with this test.
I'm trying to perform the exact same setup only with a different directory -
/var/lib/mpd/playlists
. As you may have guessed, this is the where all ofmpd
's playlists are saved. The problem appears when I edit a playlist from a client likencmpcpp
. Here isincrond
'sjournal
when I do so:What is
#6946859
? The playlist file I've edited in this test wasFabolus\ Seekers.m3u
.