[PATCH v2] fff-hoods: Fix case of missing keyxchangev2data

Tim Niemeyer tim at tn-x.org
So Okt 15 18:54:20 CEST 2017


Am Sonntag, den 15.10.2017, 18:45 +0200 schrieb mail at adrianschmutzler.de:
> Hallo Tim,
> 
> danke. Ich verstehe aber nicht, was man da quoten soll.
> 

[..]
> > >  getUpgradePath() {
> > > > > > -	if [ -s /tmp/keyxchangev2data ]; then
> > > > > > -		json_load "$(cat /tmp/keyxchangev2data)"
> > > > > > +	jsonfile="$(getJsonPath)"
> > > +
> > > > > > +	if [ -n "$jsonfile" ] ; then
> > > +		json_load "$(cat $jsonfile)"
> > 
> >                                  ^-- SC2086: Double quote to prevent globbing and word splitting.

Die Zeile müsste so aussehen:
json_load "$(cat "$jsonfile")"

Es könnte ja sein, dass $jsonfile eine Leerstelle enthält.. Deswegen
muss da quotet werden. Und ja... Sieht doof aus.. Und nein die Shell
macht darauf nicht "$(cat ", $jsonfile, ")".. ;)

Siehe auch:

cd /tmp/
echo "test" > "test file"
echo "$(cat "test file")"
echo $(cat "test file")
echo $(cat test file)
echo "$(cat test file)"

Viel Spass beim testen. ;)

Tim
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 488 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20171015/29eab070/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev