linux シェルスクリプト sed スラッシュを含む 置換

・スラッシュ(/) を含む文字列を置換するときは、sed の区切り文字を変える( / → | )


#!/bin/bash

testpath=/home/user1

echo "work dir testpath" | sed -e "s|testpath|${testpath}|g"

コメント

このブログの人気の投稿

AWS Cloudformation ImportValue Sub 併用