eval.example
来自「Shall高级编程」· EXAMPLE 代码 · 共 23 行
EXAMPLE
23 行
In the Perl script "test.pl": ... my $WEBROOT = <WEBROOT_PATH>; ...To force variable substitution try: $export WEBROOT_PATH=/usr/local/webroot $sed 's/<WEBROOT_PATH>/$WEBROOT_PATH/' < test.pl > outBut this just gives: my $WEBROOT = $WEBROOT_PATH;However: $export WEBROOT_PATH=/usr/local/webroot $eval sed 's%\<WEBROOT_PATH\>%$WEBROOT_PATH%' < test.pl > out# ====That works fine, and gives the expected substitution: my $WEBROOT = /usr/local/webroot;### Correction applied to original example by Paulo Marcel Coelho Aragao.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?