Re: [問題] 安裝軟體的路徑錯誤

看板Linux作者 (libertines)時間12年前 (2014/01/26 21:40), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串9/12 (看更多)
※ 引述《soem (流水)》之銘言: : ※ 引述《flied (libertines)》之銘言: : : lee@lee-X402CA:~$ which talys : : /usr/bin/talys : 這應該就是可以直接call得到talys指令了 : 這是之前的文章 : : lee@lee-X402CA:~/physics/talys/samples$ ./verify : : bash: ./verify: 拒絕不符權限的操作 : 這是後來你執行的狀況 : : lee@lee-X402CA:/bin$ chmod +x verify : : chmod: 無法存取 ‘verify’: 沒有此一檔案或目錄 : : lee@lee-X402CA:/bin$ ./verify : : bash: ./verify: 沒有此一檔案或目錄 : 請注意妳現在的所在目錄, : 比對兩次結果,你是不是該去 ~/physics/talys/samples 尋找你的verify : 雖然不知道為甚麼你會在/bin裡面,姑且推論一下你的想法好了: : 1. 你可能認為執行檔要在/bin底下才能跑? : => 實際上不用,跟檔案權限有關系 : 但要注意的是,如果你要執行的不是在系統$PATH裡面的程式, : 要用相對或絕對路徑的方式去呼叫。 : 像是你在 ~/physics/talys/samples裡面呼叫相對路徑 "./": : ~/physics/talys/samples$ ./verify : 或是絕對路徑 : /home/你的帳號/physics/talys/samples/verify : 若是你直接呼叫verify,就是呼叫到系統預先有的那隻verify工具。 : 2. 你可能不確定chmod的功能以及"bash: ./verify: 拒絕不符權限的操作"的成因 : => 首先無論是script或程式一般來說都需要檔案權限才能執行; : 這邊的權現有兩個面向:你的權限,和設定給檔案的權限。 : 我們先來看看一般權限的呈現方式: : $ ls -ld /bin/bash : -rwxr-xr-x 1 root root 959120 Mar 29 2013 /bin/bash : 第一組rwx是這個檔案的擁有者root所能做的事情 : read, write, execute : 第二組rwx是這個檔案的擁有者群組,root群組所能做的事情 : 所以有在root群組且非使用者root則會參考這組設定 : 第三組rwx則是除此以外的人的權限。 : 所以說,我們可以看到/bin/bash這個檔案, : - 擁有者root具有所有權限; : - 擁有者群組root沒有修改(寫入)的權限,但可以讀取和執行; : - 剩下的人亦是沒有修改、有讀取執行的權限。 : 一般的文字檔案類型往往是644,例如: : $ ls -ld /etc/hosts : -rw-r--r-- 1 root root 342 Jan 22 20:16 /etc/hosts : 我想你的~/physics/talys/samples/verify應該也是類似的情形, : 因此你需要的是幫他加上execute : ~/physics/talys/samples/$ chmod +x verify : sudo 可以幫你取得不同使用者的權限,但針對x這項設定通常需要用chmod來調整。 謝謝 我執行了這行成功 lee@lee-X402CA:~/physics/talys/samples$ ./verify bash: ./verify: 拒絕不符權限的操作 lee@lee-X402CA:~/physics/talys/samples$ chmod +x verify lee@lee-X402CA:~/physics/talys/samples$ ./verify /home/lee/physics/talys/samples/17/a/new /home/lee/physics/talys/samples/17/b/new /home/lee/physics/talys/samples/17/c/new /home/lee/physics/talys/samples/11/new /home/lee/physics/talys/samples/10/a/new /home/lee/physics/talys/samples/10/b/new /home/lee/physics/talys/samples/20/new /home/lee/physics/talys/samples/1/f/new /home/lee/physics/talys/samples/1/g/new /home/lee/physics/talys/samples/1/e/new /home/lee/physics/talys/samples/1/h/new /home/lee/physics/talys/samples/1/a/new /home/lee/physics/talys/samples/1/b/new /home/lee/physics/talys/samples/1/d/new /home/lee/physics/talys/samples/1/i/new /home/lee/physics/talys/samples/1/c/new /home/lee/physics/talys/samples/8/new /home/lee/physics/talys/samples/21/new /home/lee/physics/talys/samples/3/a/new /home/lee/physics/talys/samples/3/b/new /home/lee/physics/talys/samples/3/d/new /home/lee/physics/talys/samples/3/c/new /home/lee/physics/talys/samples/22/new /home/lee/physics/talys/samples/9/new /home/lee/physics/talys/samples/6/a/new /home/lee/physics/talys/samples/6/b/new /home/lee/physics/talys/samples/19/new /home/lee/physics/talys/samples/16/a/new /home/lee/physics/talys/samples/16/b/new /home/lee/physics/talys/samples/16/d/new /home/lee/physics/talys/samples/16/c/new /home/lee/physics/talys/samples/2/new /home/lee/physics/talys/samples/24/new /home/lee/physics/talys/samples/25/new /home/lee/physics/talys/samples/12/new /home/lee/physics/talys/samples/23/new /home/lee/physics/talys/samples/14/new /home/lee/physics/talys/samples/5/new /home/lee/physics/talys/samples/15/new /home/lee/physics/talys/samples/18/a/new /home/lee/physics/talys/samples/18/b/new /home/lee/physics/talys/samples/4/a/new /home/lee/physics/talys/samples/4/b/new /home/lee/physics/talys/samples/13/new /home/lee/physics/talys/samples/7/new 似乎成功 但readme如下 Verification ------------ - cd samples - verify Under Linux/Unix, this should run all sample cases (about 1 hour on a fast PC). 我這大概3秒就結束 所以應該還沒有裝好 : : lee@lee-X402CA:/bin$ verify : : Verify CIE values, Version 1.4.0 : 這邊就只是你的系統有安裝一個叫做verify的指令, : 但這你的使用經驗看來,那個指令並不是你這次安裝的步驟中需要呼叫到的。 Your own calculations --------------------- - talys < input > output where you can make your own input file starting from the many sample cases we provide. 我試著計算執行 錯誤如下 lee@lee-X402CA:~/physics/talys/test$ talys input output5 TALYS-error: Structure database not installed: change path in machine.f 我的machine.f 在 /home/lee/physics/talys/source https://www.dropbox.com/s/zmbhzustk6hnp6v/2014-01-26%2021%3A39%3A35.png
內容如下 https://www.dropbox.com/s/yq6o4hbraqftuf6/2014-01-26%2021%3A32%3A21.png
c ********************* Set directory for structure data *************** c c path : directory containing structure files to be read c lenpath: length of pathname c c The maximum length of the path is 60 characters c home='/home/lee/physics/talys/' (我改這行) lenhome=0 do 10 i=1,60 if (home(i:i).eq.' ') goto 100 lenhome=lenhome+1 10 continue 100 path=home(1:lenhome)//'structure/' lenpath=lenhome+10 c c Test to check accessibility of structure files c inquire (file=path(1:lenpath)//'abundance/z001',exist=lexist) if (lexist) return write(*,'(" TALYS-error: Structure database not installed:", + " change path in machine.f")') stop end Copyright (C) 2013 A.J. Koning, S. Hilaire and S. Goriely 我改的只有這部份 原本是 home='.' 不能執行後,我改成 home='/home/lee/physics/talys/' 這樣改對吧? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 101.3.47.52
文章代碼(AID): #1IvH1Wza (Linux)
討論串 (同標題文章)
文章代碼(AID): #1IvH1Wza (Linux)