像/usr/local
?如何使用文件協議訪問本地系統上的目錄?
我試圖file:///usr/local
但未能
[[email protected] robot]# cd file:///usr/local
-bash: cd: file:///usr/local: No such file or directory
像/usr/local
?如何使用文件協議訪問本地系統上的目錄?
我試圖file:///usr/local
但未能
[[email protected] robot]# cd file:///usr/local
-bash: cd: file:///usr/local: No such file or directory
的file:
協議只在網絡瀏覽器存在。嘗試在Firefox中,它應該工作。要做到這一點的外殼,只是使用
cd /usr/local/
不要使用file:
。這是同樣的原因,你不能
cat http://www.google.com
這將是真棒(但你必須使用類似wget
或curl
)。
file:///不適用於bash或派生shell。
它可以在大多數瀏覽器中使用,並且可能使用wget和curl,但bash不是Web瀏覽器。
bash和cd在我所知的多個協議中不起作用。如果你想通過其他協議訪問東西,你必須將它們掛載到本地文件系統。
你不是試圖cd到用戶提供的某些位置提供某種網頁表單嗎?
如果你必須要能夠從你的shell訪問通用網址的要求,請嘗試使用捲曲爲你的貓更換:
curl file:///path/to/file.txt
curl http://www.domain.com/file.txt
但正如其他海報指出,殼本身沒有按」瞭解網址。
如果您必須在命令行上處理file:/// usr/local,您可以刪除「file://」部分。然後做一個正常的命令,例如:
echo "file:///usr/local/" | sed 's/file:\/\///' | cd
呃...請提供更多的細節。 – Zifre 2009-06-03 21:03:08
你是如何訪問這些文件的?什麼語言,什麼程序,...? – sth 2009-06-03 21:03:35