/ /現在のシェルを終了し、perl-bash、perl、variables、exitを使用して変数を保存する方法

現在のシェルを終了してperl-bash、perl、variables、exitを使って変数を保存する方法

私はこのスクリプトを実行しましたが、現在のシェル(つまりbash)から終了しません。その後はコマンドを実行しません。

#!/usr/bin/perl
$ENV{MYVAR}="test";
exec "bash","-f";
print "End.n";

回答:

回答№1は1
$ perldoc -f exec

exec LIST
exec PROGRAM LIST
The "exec" function executes a system command and never
returns; use "system" instead of "exec" if you want it to
return.