like /usr/local
?
I tried file:///usr/local
but failed
[root@www2 robot]# cd file:///usr/local
-bash: cd: file:///usr/local: No such file or directory
like /usr/local
?
I tried file:///usr/local
but failed
[root@www2 robot]# cd file:///usr/local
-bash: cd: file:///usr/local: No such file or directory
The file:
protocol only exists in web browsers. Try it in Firefox, it should work. To do it in a shell, just use
cd /usr/local/
Don't use file:
. It's the same reason why you can't
cat http://www.google.com
Which would be awesome (but you have to use something like wget
or curl
).
file:/// doesn't work on bash or derivative shells.
It will work in most browsers, and possible wget and curl, but bash is not a web browser.
bash and cd does not function across multiple protocols to my knowledge. If you want to access stuff through other protocols you have to mount them to the local filesystem.
You're not trying to cd to some location provided by a user on some web form are you?
If you have a requirement to be able to access generic URLs from your shell, try using curl as a replacement for your cat:
curl file:///path/to/file.txt
curl http://www.domain.com/file.txt
But as other posters have pointed out, the shell itself doesn't understand URLs.
If you have to deal with file:///usr/local on the command line, you could just remove the "file://" part. And do then a normal your command, e.g.:
echo "file:///usr/local/" | sed 's/file:\/\///' | cd