2016-12-19 9 views
1

これは私のファストポストであるstackoverflowです。 私は現在、XMLファイルを解析して結果を返すために、popenと一緒にxmlstartletを使用しています。 は、私は私のプロジェクトのサブフォルダ内の「変更」ファイル(XMLの)を整理したいので、私は次のようでした:相対パスはスクリプトでは機能しません

fp = popen("xmlstarlet sel -t -m '//Program/Data' -v . -n < /DSP_DATA/test.xml", "r"); 

問題がある:私はプログラムといくつかの設定をロードするためのスクリプトを使用しています私の組込みシステム(ヘッドレス)に、私はSSHで直接プログラムをexcecuteとき、それはすべての出力を示し、偉大な動作しますが、私はスクリプトでそれを実行すると、それは示しています

以下
sh: 1: cannot open /DSP_DATA/test.xml: No such file 

があり、 excecutableをロードするために使用されたスクリプト:

#This Script will upload the excecutable at "Debug" Folder to the remote host and excecute it at terminal by SSH. 

set REMOTE_USER "pi" 
set REMOTE_IP "192.168.1.99" 

#Upload Pin Configuration Script file 
spawn scp -r remote.pinconf.sh [email protected]$REMOTE_IP:/home/pi/SoftwareTestLocation 
expect "password:" 
send "raspberry\r" 
expect "*\r" 
expect "\r" 

#Upload the Software 
spawn scp -r ../Debug/ADAU145x.bin [email protected]$REMOTE_IP:/home/pi/SoftwareTestLocation 
expect "password:" 
send "raspberry\r" 
expect "*\r" 
expect "\r" 

#Excecute Pin Configuration Script - perform an CHMOD before 
spawn ssh [email protected]$REMOTE_IP 
expect "password:" 
send "raspberry\r" 
expect "*\r" 
expect "\r" 

send -- "chmod +x ~/SoftwareTestLocation/remote.pinconf.sh\r" 

send -- "sudo ./SoftwareTestLocation/remote.pinconf.sh\r" 
expect "*\r" 
expect "\r" 

#Execute the Software 
send_user "Remote Output\n---\n---\n---\n" 
send -- "sudo ~/SoftwareTestLocation/ADAU145x.bin\r" 
expect "*\r" 
expect "END" 

私に助けてもらってください。相対パスが動作し、フォルダーからソフトウェアを直接実行する理由を発見してください。ただし、スクリプトで実行を依頼すると機能しません。

ありがとうございました。

答えて

0

/DSP_DATA/test.xmlDSP_DATAフォルダのルートディレクトリを参照することを意味します。

パスが実行可能位置からの相対パスの場合は、./DSP_DATA/test.xml

関連する問題