Right quotation for incrontab

From: Narcis Garcia - GiLUG <informatica_at_actiu.net>
Date: Fri, 23 Sep 2011 18:11:24 +0200

Here comes a proposal for next fixes or versions:

There are 2 problems in incrontab tables about spaces: difficult to
automate spaces parsing for the path watched, and bad parameters
grouping to commands. My proposal is to give the opportunity of quotes
to work, in a more consistent way with shell scripting.

1. If quotes were alowwed to specify paths, automated generation of
tables could be easier, because instead of replacing every space by an
escaped one, a script could simply write quoted strings for all:
"/home/mike/Documents/My works"
instead of the current way:
/home/mike/Documents/My\ works

2. I see the current behaviour as a bug. When the command is something like:
/usr/local/bin/myscript.sh "$@/$#"
Then for a watched file as "/home/mike/Documents/My works/first one.odt"
myscript.sh receives (including quotes):
"$1": "/home/mike/Documents/My
"$2": works/first
"$3": one.odt"
"$4": (any next parameter)
This means that the quotes aren't used by incrond nor given right to
shell interpreter/execution. If you run in a normal shell:
myscript.sh "/home/mike/Documents/My works/first one.odt" hello world
The script receives right:
"$1": /home/mike/Documents/My works/first one.odt
"$2": hello
"$3": world

Received on Tue Jun 05 2012 - 22:14:21 CEST

This archive was generated by hypermail 2.2.0 : Tue Jun 05 2012 - 22:14:21 CEST