LinHES Forums
http://forums.linhes.org/

command not found error???
http://forums.linhes.org/viewtopic.php?f=14&t=6938
Page 1 of 1

Author:  Darth_tater [ Tue Nov 15, 2005 7:04 pm ]
Post subject:  command not found error???

ok. i have a directvbox with a serial input on the back (tht maked is SO much easyier!)
so i reinstall this weekend because something got realy fuxxored up (my "all knowing, linux loving cousin" screwd something up, and he dosent know enough about what he did to tell me, so i can fix it. anyhoo, i reinstalled.

now i need to get the script
so this is what i did
su
cd /root/
wget http://www.pdp8.net/directv/directv.pl
chmod a+x directv.pl


that should make the script executable right???
and there were no erors useing wget
so now i should just be able to do
directv.pl
that will list all the commands that it will work with.
but instead i get
bash: dirrectv.pl command not found.

and just to make shure i did it right, i
cd /root/
dir
directv.pl [some other files, but i cant rember]

so its there, and it should be working. i know that all that i needed 2 do last time

so what gives?

Author:  tjc [ Tue Nov 15, 2005 8:10 pm ]
Post subject: 

Try:
Code:
./directv.pl
I'm not even going to try to explain why tonight... ;-)

Author:  cesman [ Tue Nov 15, 2005 9:14 pm ]
Post subject: 

You should move that to /usr/local/bin. You should also try to avoid getting things as root.

Author:  Darth_tater [ Tue Nov 15, 2005 9:24 pm ]
Post subject: 

tjc wrote:
Try:
Code:
./directv.pl
I'm not even going to try to explain why tonight... ;-)


thats ok, i have had many questions, and i just wana say thanks for answering them.

its ppl like oyu that help noobs like me out, making this form a better one and encouraging more and more ppl to use this great piece of software.

and, maby not 2 night,but a simple explination would help, as i will a) not ask that question, b) expand my knowedge c) if another person in need of that knowedge wonders by this post then they will know, without having 2 repost/ask annoying ?'s

Author:  tjc [ Tue Nov 15, 2005 9:42 pm ]
Post subject: 

What Cecil said is true too. Once you've tested it, move the file to /usr/local/bin and make sure it has the right ownership and permissions as follows:
Code:
cp directv.pl /usr/local/bin
chown root:root /usr/local/bin/directv.pl
chmod u=rwx,go=rx /usr/local/bin/directv.pl

When you go back into mythtv-setup and tell it to use the script to control your external tuner, remember to use the full path name: /usr/local/bin/directv.pl

Author:  Xsecrets [ Tue Nov 15, 2005 10:52 pm ]
Post subject: 

and the explanation of the ./scriptname.type

basically you are running the script using a relative path. You can always run a script (if it's marked executable) using the full path /path/to/my/script.type, but if you are in the directory with the script to save some typing you can run ./script.type if you notice when you run an ls you see . and ..

. means this dir and .. means one directory up in the tree, so ./filename runs the file from this directory you can also use the .. for instance if you are in /home/mythtv/somedir you can type ../filename and it will run /home/mythtv/filename

and now you see why tjc didn't want to try to explain it, and I'm certainly not doing it any justice.

Author:  Darth_tater [ Tue Nov 15, 2005 11:03 pm ]
Post subject: 

Xsecrets wrote:
and the explanation of the ./scriptname.type

basically you are running the script using a relative path. You can always run a script (if it's marked executable) using the full path /path/to/my/script.type, but if you are in the directory with the script to save some typing you can run ./script.type if you notice when you run an ls you see . and ..

. means this dir and .. means one directory up in the tree, so ./filename runs the file from this directory you can also use the .. for instance if you are in /home/mythtv/somedir you can type ../filename and it will run /home/mythtv/filename

and now you see why tjc didn't want to try to explain it, and I'm certainly not doing it any justice.


i do hwever aprechiate you taking the time to xplain. tx

Author:  tjc [ Wed Nov 16, 2005 12:01 am ]
Post subject: 

Well it's already tomorrow here now, so maybe I'll take a crack at explaining it... ;-)

When you execute a command in Unix/Linux there are two ways for the system to find it:

1) You provide an absolute or relative file name for the command which points directly to it. For example "/usr/local/bin/directv.pl" or "./directv.pl", the first one is fully specified from the root of the directory tree, the second one is relative to the current directory.

2) You provide a unqualified name which the system looks up by searching through the directories listed in your "PATH" variable. For example "nano" which is actually:
Code:
root@black2:~# type nano
nano is /bin/nano
root@black2:~# echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games
root@black2:~# for p in $(echo $PATH | sed '/:/s// /g'); do ls -l $p/nano ; done
ls: /sbin/nano: No such file or directory
-rwxr-xr-x  1 root root 113880 Jan 18  2005 /bin/nano
ls: /usr/sbin/nano: No such file or directory
lrwxrwxrwx  1 root root 9 Nov  6 18:07 /usr/bin/nano -> /bin/nano
ls: /usr/X11R6/bin/nano: No such file or directory
ls: /usr/local/sbin/nano: No such file or directory
ls: /usr/local/bin/nano: No such file or directory
ls: /usr/games/nano: No such file or directory

Here you can see, where the system will find nano, the setting of your PATH, and whether or not the file (or a proxy for it) exists in all the possible locations. Notice that while nano is available from two different locations here ("/bin" and "/usr/bin") the first one the system actually finds while searching your PATH is used.

This may bring up the question of why "." (aka - current directory) is not included in your PATH. The main reason, is that it would be VERY VERY dangerous, to the point of sheer lunacy, especially for root. Let's say you've got some bozo loose on your system who likes to do the evil 777 thing (Yes, in my world 777 is the number of the beast). and as a result they've made everything in sight executable. Now you're suddenly in a minefield where any finger flub, bad tab completion, or even attempting to use a common but locally "unavailable" command may lead to executing some arbitrary file in the current directory... I don't know about you, but just thinking about the potential consequences makes me break out in a cold sweat...

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/