YUKI Hiroshi
yuki****@clear*****
Tue Aug 19 12:31:03 JST 2014
> ↑うっかり途中で送ってしまったので最後まで書いておくと
> fishはさすがにサポートせんでよいのではと思いました。理由は↓と同じです。
はい。しかし
A. fishでは動くがdashやbashでは動かない書き方
B. dashやbashでは動くがfishでは動かない書き方
C. dashでもbashでもfishでも動く(且つ違和感のない)書き方
の3通りがあるのならCを選びたいと思っています。
今回の事例では、元々dash/bashを想定してはいたものの、${...} でなければ動
かないという例ではないし、別の箇所でも元から $... と波括弧無しで書いてい
る部分があるので、こちらに合わせれば「統一感が出る」「タイプ数が減る」
「fishでも動く」と3つもメリットがあるのでそうしない手はないのではない
か、と考えた次第です。
HAYASHI Kentaro wrote:
>
> On Tue, 19 Aug 2014 12:20:22 +0900
> YUKI Hiroshi <yuki �� clear-code.com> wrote:
>
>>>
>>> fishだと {$x}は動くみたいですよ。
>
> ↑うっかり途中で送ってしまったので最後まで書いておくと
> fishはさすがにサポートせんでよいのではと思いました。理由は↓と同じです。
>
>> チュートリアルには、実践を楽にするために、なるべくいろんな環境でそのまま
>> 使えるコマンドラインを置いておきたいので、bashやdashで動かない(もしくは
>> 一般的でない)表現は避けたいと思っています。
>> こう書いてしまうと、逆にbash/dashでは意味が変わってしまって期待通りの結
>> 果にならないですよね。
>>
>>
>> HAYASHI Kentaro wrote:
>>>
>>> fishだと {$x}は動くみたいですよ。
>>>
>>> On Tue, 19 Aug 2014 12:13:09 +0900
>>> YUKI Hiroshi <yuki �� clear-code.com> wrote:
>>>
>>>> http://ja.wikipedia.org/wiki/Friendly_interactive_shell
>>>> これによると、$()も${}も無いということのようですねぇ
>>>>
>>>> YUKI Hiroshi wrote:
>>>>> fish 2.1.0 だそうです。
>>>>>
>>>>> Kenji Okimoto wrote:
>>>>>>
>>>>>>
>>>>>> On 2014年08月19日 11:53, YUKI Hiroshi wrote:
>>>>>>> 新美さんが使ってるシェルでは動かないらしいんです。。。
>>>>>>
>>>>>> 何を使ってるんでしょうか?
>>>>>> 参考までに、バージョン込みで教えて欲しいです。
>>>>>>
>>>>>>>
>>>>>>> Kouhei Sutou wrote:
>>>>>>>> dashでもいけるから大丈夫じゃない!?
>>>>>>>>
>>>>>>>> % dash
>>>>>>>> $ endpoint=x
>>>>>>>> $ echo "a${endpoint}c"
>>>>>>>> axc
>>>>>>>>
>>>>>>>>
>>>>>>>> In <20140819.115034.1792408180683606897.kou �� clear-code.com>
>>>>>>>> "Re: [Groonga-commit] droonga/droonga.org �� a66a101 [gh-pages] Don't use "${...}" style (it doesn't work some shells)" on Tue, 19 Aug 2014 11:50:34 +0900 (JST),
>>>>>>>> Kouhei Sutou <kou �� clear-code.com> wrote:
>>>>>>>>
>>>>>>>>>> Don't use "${...}" style (it doesn't work some shells)
>>>>>>>>>
>>>>>>>>> え!?そうなの!?
>>>>>>>>>
>>>>>>>>> In <a66a101c6a14cae0d252c995190c8c7fd78cb508 �� jenkins.clear-code.com>
>>>>>>>>> "[Groonga-commit] droonga/droonga.org �� a66a101 [gh-pages] Don't use "${...}" style (it doesn't work some shells)" on Tue, 19 Aug 2014 11:39:15 +0900,
>>>>>>>>> YUKI Hiroshi <null+groonga �� clear-code.com> wrote:
>>>>>>>>>
>>>>>>>>>> YUKI Hiroshi 2014-08-19 11:39:15 +0900 (Tue, 19 Aug 2014)
>>>>>>>>>>
>>>>>>>>>> New Revision: a66a101c6a14cae0d252c995190c8c7fd78cb508
>>>>>>>>>> https://github.com/droonga/droonga.org/commit/a66a101c6a14cae0d252c995190c8c7fd78cb508
>>>>>>>>>>
>>>>>>>>>> Message:
>>>>>>>>>> Don't use "${...}" style (it doesn't work some shells)
>>>>>>>>>>
>>>>>>>>>> Modified files:
>>>>>>>>>> tutorial/1.0.6/dump-restore/index.md
>>>>>>>>>> tutorial/1.0.6/groonga/index.md
>>>>>>>>>>
>>>>>>>>>> Modified: tutorial/1.0.6/dump-restore/index.md (+9 -9)
>>>>>>>>>> ===================================================================
>>>>>>>>>> --- tutorial/1.0.6/dump-restore/index.md 2014-08-14 18:46:29 +0900 (335931a)
>>>>>>>>>> +++ tutorial/1.0.6/dump-restore/index.md 2014-08-19 11:39:15 +0900 (1d7b523)
>>>>>>>>>> @@ -141,19 +141,19 @@ If you are reading this tutorial sequentially, you'll have an existing cluster a
>>>>>>>>>> Make it empty with these commands:
>>>>>>>>>>
>>>>>>>>>> # endpoint="http://192.168.0.10:10041"
>>>>>>>>>> - # curl "${endpoint}/d/table_remove?name=Location"
>>>>>>>>>> + # curl "$endpoint/d/table_remove?name=Location"
>>>>>>>>>> [[0,1406610703.2229023,0.0010793209075927734],true]
>>>>>>>>>> - # curl "${endpoint}/d/table_remove?name=Store"
>>>>>>>>>> + # curl "$endpoint/d/table_remove?name=Store"
>>>>>>>>>> [[0,1406610708.2757723,0.006396293640136719],true]
>>>>>>>>>> - # curl "${endpoint}/d/table_remove?name=Term"
>>>>>>>>>> + # curl "$endpoint/d/table_remove?name=Term"
>>>>>>>>>> [[0,1406610712.379644,0.00006723403930664062],true]
>>>>>>>>>>
>>>>>>>>>> After that the cluster becomes empty. Confirm it:
>>>>>>>>>>
>>>>>>>>>> # endpoint="http://192.168.0.10:10041"
>>>>>>>>>> - # curl "${endpoint}/d/table_list"
>>>>>>>>>> + # curl "$endpoint/d/table_list"
>>>>>>>>>> [[0,1406610804.1535122,0.0002875328063964844],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["default_tokenizer","ShortText"],["normalizer","ShortText"]]]]
>>>>>>>>>> - # curl "${endpoint}/d/select?table=Store&output_columns=name&limit=10"
>>>>>>>>>> + # curl "$endpoint/d/select?table=Store&output_columns=name&limit=10"
>>>>>>>>>> [[0,1401363465.610241,0],[[[null],[]]]]
>>>>>>>>>>
>>>>>>>>>> ### Restore data from a dump result, to an empty Droonga cluster
>>>>>>>>>> @@ -176,7 +176,7 @@ Note to these things:
>>>>>>>>>>
>>>>>>>>>> Then the data is completely restored. Confirm it:
>>>>>>>>>>
>>>>>>>>>> - # ${endpoint}/select?table=Store&output_columns=name&limit=10"
>>>>>>>>>> + # $endpoint/select?table=Store&output_columns=name&limit=10"
>>>>>>>>>> [[0,1401363556.0294158,0.0000762939453125],[[[40],[["name","ShortText"]],["1st Avenue & 75th St. - New York NY (W)"],["76th & Second - New York NY (W)"],["Herald Square- Macy's - New York NY"],["Macy's 5th Floor - Herald Square - New York NY (W)"],["80th & York - New York NY (W)"],["Columbus @ 67th - New York NY (W)"],["45th & Broadway - New York NY (W)"],["Marriott Marquis - Lobby - New York NY"],["Second @ 81st - New York NY (W)"],["52nd & Seventh - New York NY (W)"]]]]
>>>>>>>>>>
>>>>>>>>>> ## Duplicate an existing Droonga cluster to another empty cluster directly
>>>>>>>>>> @@ -204,9 +204,9 @@ Construct two clusters by `droonga-engine-catalog-modify` and make one cluster e
>>>>>>>>>> --update \
>>>>>>>>>> --replica-hosts=$host
>>>>>>>>>> # endpoint="http://$host:10041"
>>>>>>>>>> - # curl "${endpoint}/d/table_remove?name=Location"
>>>>>>>>>> - # curl "${endpoint}/d/table_remove?name=Store"
>>>>>>>>>> - # curl "${endpoint}/d/table_remove?name=Term"
>>>>>>>>>> + # curl "$endpoint/d/table_remove?name=Location"
>>>>>>>>>> + # curl "$endpoint/d/table_remove?name=Store"
>>>>>>>>>> + # curl "$endpoint/d/table_remove?name=Term"
>>>>>>>>>>
>>>>>>>>>> After that there are two clusters: one contains `192.168.0.10` with data, another contains `192.168.0.11` with no data. Confirm it:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Modified: tutorial/1.0.6/groonga/index.md (+12 -12)
>>>>>>>>>> ===================================================================
>>>>>>>>>> --- tutorial/1.0.6/groonga/index.md 2014-08-14 18:46:29 +0900 (2c50b5e)
>>>>>>>>>> +++ tutorial/1.0.6/groonga/index.md 2014-08-19 11:39:15 +0900 (7ddfacb)
>>>>>>>>>> @@ -193,7 +193,7 @@ Requests are completely same to ones for a Groonga server.
>>>>>>>>>> To create a new table `Store`, you just have to send a GET request for the `table_create` command, like:
>>>>>>>>>>
>>>>>>>>>> # endpoint="http://192.168.0.10:10041"
>>>>>>>>>> - # curl "${endpoint}/d/table_create?name=Store&flags=TABLE_PAT_KEY&key_type=ShortText"
>>>>>>>>>> + # curl "$endpoint/d/table_create?name=Store&flags=TABLE_PAT_KEY&key_type=ShortText"
>>>>>>>>>> [[0,1401358896.360356,0.0035653114318847656],true]
>>>>>>>>>>
>>>>>>>>>> Note that you have to specify the host, one of Droonga nodes with active droonga-http-server, in your Droonga cluster.
>>>>>>>>>> @@ -202,20 +202,20 @@ All requests will be distributed to suitable nodes in the cluster.
>>>>>>>>>>
>>>>>>>>>> Next, create new columns `name` and `location` to the `Store` table by the `column_create` command, like:
>>>>>>>>>>
>>>>>>>>>> - # curl "${endpoint}/d/column_create?table=Store&name=name&flags=COLUMN_SCALAR&type=ShortText"
>>>>>>>>>> + # curl "$endpoint/d/column_create?table=Store&name=name&flags=COLUMN_SCALAR&type=ShortText"
>>>>>>>>>> [[0,1401358348.6541538,0.0004096031188964844],true]
>>>>>>>>>> - # curl "${endpoint}/d/column_create?table=Store&name=location&flags=COLUMN_SCALAR&type=WGS84GeoPoint"
>>>>>>>>>> + # curl "$endpoint/d/column_create?table=Store&name=location&flags=COLUMN_SCALAR&type=WGS84GeoPoint"
>>>>>>>>>> [[0,1401358359.084659,0.002511262893676758],true],true]
>>>>>>>>>>
>>>>>>>>>> Create indexes also.
>>>>>>>>>>
>>>>>>>>>> - # curl "${endpoint}/d/table_create?name=Term&flags=TABLE_PAT_KEY&key_type=ShortText&default_tokenizer=TokenBigram&normalizer=NormalizerAuto"
>>>>>>>>>> + # curl "$endpoint/d/table_create?name=Term&flags=TABLE_PAT_KEY&key_type=ShortText&default_tokenizer=TokenBigram&normalizer=NormalizerAuto"
>>>>>>>>>> [[0,1401358475.7229664,0.002419710159301758],true]
>>>>>>>>>> - # curl "${endpoint}/d/column_create?table=Term&name=store_name&flags=COLUMN_INDEX|WITH_POSITION&type=Store&source=name"
>>>>>>>>>> + # curl "$endpoint/d/column_create?table=Term&name=store_name&flags=COLUMN_INDEX|WITH_POSITION&type=Store&source=name"
>>>>>>>>>> [[0,1401358494.1656318,0.006799221038818359],true]
>>>>>>>>>> - # curl "${endpoint}/d/table_create?name=Location&flags=TABLE_PAT_KEY&key_type=WGS84GeoPoint"
>>>>>>>>>> + # curl "$endpoint/d/table_create?name=Location&flags=TABLE_PAT_KEY&key_type=WGS84GeoPoint"
>>>>>>>>>> [[0,1401358505.708896,0.0016951560974121094],true]
>>>>>>>>>> - # curl "${endpoint}/d/column_create?table=Location&name=store&flags=COLUMN_INDEX&type=Store&source=location"
>>>>>>>>>> + # curl "$endpoint/d/column_create?table=Location&name=store&flags=COLUMN_INDEX&type=Store&source=location"
>>>>>>>>>> [[0,1401358519.6187897,0.024788379669189453],true]
>>>>>>>>>>
>>>>>>>>>> *IMPORTANT NOTE*: Don't run `table_list` or `column_list` before the table is completely created.
>>>>>>>>>> @@ -225,7 +225,7 @@ This is a known issue on the version {{ site.droonga_version }}, and it will be
>>>>>>>>>> OK, now the table has been created successfully.
>>>>>>>>>> Let's see it by the `table_list` command:
>>>>>>>>>>
>>>>>>>>>> - # curl "${endpoint}/d/table_list"
>>>>>>>>>> + # curl "$endpoint/d/table_list"
>>>>>>>>>> [[0,1401358908.9126804,0.001600027084350586],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["default_tokenizer","ShortText"],["normalizer","ShortText"]],[256,"Store","/home/vagrant/droonga/000/db.0000100","TABLE_PAT_KEY|PERSISTENT","ShortText",null,null,null]]]
>>>>>>>>>>
>>>>>>>>>> Because it is a cluster, another endpoint returns same result.
>>>>>>>>>> @@ -288,7 +288,7 @@ stores.json:
>>>>>>>>>>
>>>>>>>>>> Then, send it as a POST request of the `load` command, like:
>>>>>>>>>>
>>>>>>>>>> - # curl --data "@stores.json" "${endpoint}/d/load?table=Store"
>>>>>>>>>> + # curl --data "@stores.json" "$endpoint/d/load?table=Store"
>>>>>>>>>> [[0,1401358564.909,0.158],[40]]
>>>>>>>>>>
>>>>>>>>>> Now all data in the JSON file are successfully loaded.
>>>>>>>>>> @@ -299,14 +299,14 @@ OK, all data is now ready.
>>>>>>>>>>
>>>>>>>>>> As the starter, let's select initial ten records with the `select` command:
>>>>>>>>>>
>>>>>>>>>> - # curl "${endpoint}/d/select?table=Store&output_columns=name&limit=10"
>>>>>>>>>> + # curl "$endpoint/d/select?table=Store&output_columns=name&limit=10"
>>>>>>>>>> [[0,1401362059.7437818,0.00004935264587402344],[[[40],[["name","ShortText"]],["1st Avenue & 75th St. - New York NY (W)"],["76th & Second - New York NY (W)"],["Herald Square- Macy's - New York NY"],["Macy's 5th Floor - Herald Square - New York NY (W)"],["80th & York - New York NY (W)"],["Columbus @ 67th - New York NY (W)"],["45th & Broadway - New York NY (W)"],["Marriott Marquis - Lobby - New York NY"],["Second @ 81st - New York NY (W)"],["52nd & Seventh - New York NY (W)"]]]]
>>>>>>>>>>
>>>>>>>>>> Of course you can specify conditions via the `query` option:
>>>>>>>>>>
>>>>>>>>>> - # curl "${endpoint}/d/select?table=Store&query=Columbus&match_columns=name&output_columns=name&limit=10"
>>>>>>>>>> + # curl "$endpoint/d/select?table=Store&query=Columbus&match_columns=name&output_columns=name&limit=10"
>>>>>>>>>> [[0,1398670157.661574,0.0012705326080322266],[[[2],[["_key","ShortText"]],["Columbus @ 67th - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"]]]]
>>>>>>>>>> - # curl "${endpoint}/d/select?table=Store&filter=name@'Ave'&output_columns=name&limit=10"
>>>>>>>>>> + # curl "$endpoint/d/select?table=Store&filter=name@'Ave'&output_columns=name&limit=10"
>>>>>>>>>> [[0,1398670586.193325,0.0003848075866699219],[[[3],[["_key","ShortText"]],["2nd Ave. & 9th Street - New York NY"],["84th & Third Ave - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"]]]]
>>>>>>>>>>
>>>>>>>>>> ## Conclusion
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> Groonga-commit mailing list
>>>>>>>>> Groonga-commit �� lists.sourceforge.jp
>>>>>>>>> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Groonga-commit mailing list
>>>>>>>> Groonga-commit �� lists.sourceforge.jp
>>>>>>>> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> 結城 洋志 <YUKI Hiroshi>
>>>> E-mail: yuki �� clear-code.com
>>>>
>>>> 株式会社クリアコード
>>>> 〒113-0033 東京都文京区本郷3-27-12
>>>> 本郷デントビル2階
>>>> TEL : 03-6231-7270
>>>> FAX : 03-6231-7271
>>>> WWW : http://www.clear-code.com/
>>>>
>>>> _______________________________________________
>>>> Groonga-commit mailing list
>>>> Groonga-commit �� lists.sourceforge.jp
>>>> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
>>>
>>>
>>
>> --
>> 結城 洋志 <YUKI Hiroshi>
>> E-mail: yuki �� clear-code.com
>>
>> 株式会社クリアコード
>> 〒113-0033 東京都文京区本郷3-27-12
>> 本郷デントビル2階
>> TEL : 03-6231-7270
>> FAX : 03-6231-7271
>> WWW : http://www.clear-code.com/
>>
>> _______________________________________________
>> Groonga-commit mailing list
>> Groonga-commit �� lists.sourceforge.jp
>> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
>
>
--
結城 洋志 <YUKI Hiroshi>
E-mail: yuki �� clear-code.com
株式会社クリアコード
〒113-0033 東京都文京区本郷3-27-12
本郷デントビル2階
TEL : 03-6231-7270
FAX : 03-6231-7271
WWW : http://www.clear-code.com/