2011-11-11 11 views
0

次の例では、文字列の末尾に余分なスラッシュを付けるのはなぜですか?redis出力の余分なスラッシュ

[[email protected] src]# echo 'testme one more word new line' | ./redis-cli -x set mytest 
OK 

[[email protected] src]# ./redis-cli 
redis> get mytest 
"testme one more word new line\" 

上記の例では、\を「行\」にしたくありません。元のechoステートメントにはありません。

答えて

3

私が得ているのは、バックスラッシュではなく、ブレークライン(バックスラッシュ+ n)です。 これは "echo"コマンドで追加されます。 echo -nを使用すると、余分なブレークラインを避けることができます。

$ echo -n 'testme one more word new line' | ./src/redis-cli -x set mytest 
OK 
$ ./src/redis-cli get mytest 
"testme one more word new line" 
関連する問題