mysql 使用 shell script問題 - Linux

By William
at 2015-07-05T12:41
at 2015-07-05T12:41
Table of Contents
https://gist.github.com/anonymous/678d384c050a0012559c
cmd="'select test_seq, year, month, day, hour, minute, name,\
hop_no, test1_hop, test1_RTT, test2_hop, test2_RTT, test3_hop, \
test3_RTT, usr_id from dmp.temp_table where label=$i'"
mysql -h localhost -u root -pf0409 -Bse $cmd > $file
為什麼拆成這樣不行 , echo $cmd 印出來的 mysql command 沒問題 , 但是就是失敗
必須改成下面寫法才可以請問這是什麼原因?
mysql -h localhost -u root -pf0409 -Bse "select test_seq, year, month, \
day, hour, minute, name, hop_no, \
test1_hop, test1_RTT, test2_hop, \
test2_RTT, test3_hop, test3_RTT, \
usr_id from test.temp_table where label=$i" > $file
謝謝
--
Tags:
Linux
All Comments

By Joe
at 2015-07-09T08:56
at 2015-07-09T08:56

By Kyle
at 2015-07-13T21:38
at 2015-07-13T21:38

By Harry
at 2015-07-17T12:59
at 2015-07-17T12:59

By Emma
at 2015-07-18T23:40
at 2015-07-18T23:40

By Eartha
at 2015-07-23T06:01
at 2015-07-23T06:01

By Ursula
at 2015-07-23T18:04
at 2015-07-23T18:04

By Connor
at 2015-07-27T00:43
at 2015-07-27T00:43

By Charlie
at 2015-07-29T23:28
at 2015-07-29T23:28

By James
at 2015-07-31T13:19
at 2015-07-31T13:19
Related Posts
Rpi如何偵測行動電源的電量?

By Selena
at 2015-07-02T20:40
at 2015-07-02T20:40
tty中文顯示問題

By Brianna
at 2015-07-02T20:30
at 2015-07-02T20:30
我們成立了一個後端伺服的line群

By Jacky
at 2015-07-01T23:32
at 2015-07-01T23:32
F@H command line 進度

By Emma
at 2015-07-01T23:05
at 2015-07-01T23:05
Ubuntu電池電量被藍牙滑鼠影響

By Megan
at 2015-07-01T19:39
at 2015-07-01T19:39