2017-05-12 9 views
0

LinuxシステムにRをインストールしました。私もパッケージ "x"をインストールしています。私は、ライブラリが正しくロードされているかどうかを確認するためのシンプルなシェルスクリプトを書いています。また、 'x'パッケージに 'f'という名前のAPIがあり、シェルスクリプトがそれを実行してエラーなしで動作していることを確認できるはずです。シェルスクリプトによるRライブラリの読み込み機能のテスト

要するに、以下のR機能をシェルスクリプトの助けを借りてテストしたいと思います。以下のものの作品が他の真falseを返すと

$ R 


Copyright (C) The R Foundation for Statistical Computing 
Platform: x86_64-pc-linux-gnu (64-bit) 

R is free software and comes with ABSOLUTELY NO WARRANTY. 
You are welcome to redistribute it under certain conditions. 
Type 'license()' or 'licence()' for distribution details. 

R is a collaborative project with many contributors. 
Type 'contributors()' for more information and 
'citation()' on how to cite R or R packages in publications. 

Type 'demo()' for some demos, 'help()' for on-line help, or 
'help.start()' for an HTML browser interface to help. 
Type 'q()' to quit R. 

R > library(x) 
library loaded 
R> f(c(1,2,3)) 
#No error thrown 

答えて

1

は次のように動作するはずです:

R --no-save <<EOF 
library(x) 
f(c(1,2,3)) 
EOF 
if test $? = 0 ; then 
    echo "good" 
else 
    echo "bad" 
fi 
関連する問題