Running tar files
I recently had a problem after upgrading Ubuntu 7.10 32 bit to 8.10 64 bit. Sunbird would not work. I had to reinstall it but it would only install the 64 bit version which would not read my files.
I downloaded the 32 bit version and untared it to my download directory. It would not recognize the binary run files. Found a web page that advised to move the sunbird directory to opt and make a link to usr. Worked like a charm! Sunbird is the only directory in my /opt dir. Where does one normally put untared files for programs and what is the trick to get them to run? I guess this question applies only to tars that untar in the pwd. Thanks, bobland |
If you want to execute a program without typing it's full path, then it needs to be in your $PATH.
That would usually mean that you put it in /usr/local/bin or $HOME/bin, or a link from the extracted binary to one of those locations. |
Other options are to add the location to your PATH variable by
adding to it in the ~/.bash_profile as PATH=$PATH:/path_to_program or to simply add an alias in ~/.bashrc to the alias pro='/opt/path/bin/program' or to similar files for different shells. |
I can understand adding the program to the path variable but why wouldn't it run from its own directory?
bobland |
if your current working directory ($PWD) is not in the $PATH then precede the command with ./
eg. $ ls mycommand.sh $ mycommand.sh bash: mycommand.sh: command not found $ ./mycommand.sh HOORAY! ;) |
Quote:
You can add it, but it's considered a security risk. If you download some malware or someone place a binary file called "ls" in your home directory, and you have ./ in your $PATH it might be run instead of the system command ls, which might result in very bad things if it's indeed some kind of malware. I advice you to follow the convention, and run the program as ./myprog, which is what everyone else does. |
All times are GMT -5. The time now is 08:13 PM. |