kristopolous / TickTick

JSON in your Bash scripts
http://9ol.es/TheEmperorsNewClothes.html
Other
579 stars 55 forks source link

* is not parsed correctly #36

Closed pmitchev closed 10 years ago

pmitchev commented 10 years ago

The following code is not working:

! /usr/bin/env bash

. ticktick.sh DATA='{"a":"*"}' tickParse "$DATA" echo a

It outputs ls of the current directory. OS: MacOSX

kristopolous commented 10 years ago

Hah. clever clever. I bet this is just standard shell globbing. Let me look into it now.

On 11/28/2014 04:12 AM, pmitchev wrote:

The following code is not working:

! /usr/bin/env bash

. ticktick.sh DATA='{"a":"*"}' tickParse "$DATA" echo |a|

It outputs |ls| of the current directory. OS: MacOSX

— Reply to this email directly or view it on GitHub https://github.com/kristopolous/TickTick/issues/36.

kristopolous commented 10 years ago

Ok so you are close.

There's something that needs to be documented called tickVars that may have helped you getting here.

Basically what happens is this:

#!/bin/bash

n='*'
echo $n

The * gets replaced by the variable substitution before the globber runs. In order to print just the asterisk you'll need to encapsulate that as follows

echo "$n"

As in, this is a bash-ism and therefore not my bug.

/wipes sweat-laden forehead in relief.