I'm asking because when I use ./wireshark I get an error message that is different from when I run it by using wireshark only. Thanks in advance! asked 16 Jun '14, 16:44 flora |
One Answer:
In UNIX, a command on its own like "wireshark" will execute the "wireshark" program that is found in a directory in your "PATH" environmental variable. Using "./wireshark" would call the program "wireshark" in your current directory. The distinction is useful if you have multiple versions of wireshark installed. To see which wireshark will be run when you just type "wireshark" try typing the command "which wireshark" and it will tell you what one is found in directories in your "PATH". answered 16 Jun '14, 18:20 Quadratic edited 16 Jun '14, 18:21 |
Thanks for your reply! So is it like "wireshark" runs what is in the install location but "./wireshark" runs what is in the build directory?
In deed, I've got confused when I found the following in a wireshark README.plugins file "The bad news is that Wireshark will not use the plugins unless the plugins are installed in one of the places it expects them to find. One way of dealing with this problem is to set an environment variable when running Wireshark: WIRESHARK_RUN_FROM_BUILD_DIRECTORY=1. " why we should use that environmental variable if we are at the build directory already?!
"wireshark" runs whatever it first finds in your PATH; it might be in the current directory, if that's the first directory in PATH that contains a Wireshark binary (an empty entry in PATH means "the current directory"), or it might be in the install location, if that's the first directory in PATH that contains a Wireshark binary.
"./wireshark" runs whatever is in the current directory, which isn't guaranteed to be the build directory; if, for example, Wireshark is installed in "/usr/local/bin/wireshark", then, if you do "cd /usr/local/bin", and then do "./wireshark", it'll run what is in the current directory, i.e. it'll run "/usr/local/bin/wireshark".
Because Wireshark can't figure that out for itself, as it doesn't know what the build directory is.
Thanks for correcting me. It is clear now.