开发者

Using SVN from a Unix shell doesn't recognise vars

开发者 https://www.devze.com 2023-02-11 16:29 出处:网络
In a Unix shell I try the following: svn_checkout_dir=\"svn\" svn add \"$svn_server\" \"$svn_checkout_dir/save\"

In a Unix shell I try the following:

svn_checkout_dir="svn"
svn add "$svn_server" "$svn_checkout_dir/save"

: but the "$svn_checkout_dir/save" will not resolve to "svn/save". Am I us开发者_开发百科ing this in the wrong way?


You have to export the svn_checkout_dir before calling svn:

export svn_checkout_dir="svn"
svn add "$svn_server" "$svn_checkout_dir/save"

If you don't do that, svn_checkout_dir is only a local variable, not an environment variable visible to the svn process. So, in your case (assuming that svn_checkout_dir and svn_server are defined the same way), your call evaluates to

svn add "" "/save"

as long as you don't export svn_server and svn_checkout_dir.

If you put your two lines into a script however, it would work as expected since within the script, svn_checkout_dir is visible as local variable (and overrides a possibly existent environment variable with the same name).

0

精彩评论

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

关注公众号