sed 帶變數 如何取代 特殊符號 - Linux

By Audriana
at 2015-08-27T11:20
at 2015-08-27T11:20
Table of Contents
如題使用bash 使用sed 如何取代""
取代文件 內容
testver = "123"
bash 內容
testv1=$(cat "/home/test/test.cfg" | grep 'test' |awk -F 'test' '{printer $2}'
sed -i "s/test=$test1/ver=$test2 /g" /home/test.cfg
但卻無法成功 如果是直接用數字替換是自是可以的
bash 要如何取代""
目的test= "123" 替換成 test= "456"
--
Tags:
Linux
All Comments

By Kristin
at 2015-08-28T20:52
at 2015-08-28T20:52

By Agnes
at 2015-09-01T23:16
at 2015-09-01T23:16

By Madame
at 2015-09-02T04:08
at 2015-09-02T04:08

By Olivia
at 2015-09-05T21:15
at 2015-09-05T21:15

By Connor
at 2015-09-07T17:05
at 2015-09-07T17:05

By Tristan Cohan
at 2015-09-12T14:13
at 2015-09-12T14:13

By Eartha
at 2015-09-14T10:51
at 2015-09-14T10:51

By Madame
at 2015-09-17T10:10
at 2015-09-17T10:10

By John
at 2015-09-20T19:42
at 2015-09-20T19:42
Related Posts
How to make a new installable Linux?

By Gary
at 2015-08-26T15:22
at 2015-08-26T15:22
我該選擇哪種Linux版本

By Sarah
at 2015-08-24T14:51
at 2015-08-24T14:51
檔案無法操作的問題

By Regina
at 2015-08-24T11:11
at 2015-08-24T11:11
grsec + arch 設定+使用經驗

By Connor
at 2015-08-23T21:57
at 2015-08-23T21:57
visudo中的命令限制

By Irma
at 2015-08-23T09:31
at 2015-08-23T09:31