开发者

Get a file content in Bash after expanding its variables

cat file

$VAR

cat script开发者_如何学Go

#!/bin/bash
CONTENT=$(<file)
echo $CONTENT

./script

$VAR

I'd like to get the variable's actual value, not "$VAR". How to get a weaker quoting? Many thanks!


This should do it:

CONTENT=$(eval echo -e `<file`)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜