01-18-2006 10:56 PM
when i create a script name is "test", after creation when i run the script, it always run ./test. please tell me why i need to give ./ for running. i am a root user and created thru root user.
01-18-2006 10:59 PM
You either copy your script "test" in /usr/bin or add path of your test script to PATH.
# export PATH=$PATH:
This way you don't have to specify ./
Hope that helps.
01-18-2006 11:01 PM
Most likely $PATH does not contain "." (your home directory). For the root user, this is deliberate, as putting "." in root's PATH is considered a security risk.
01-18-2006 11:05 PM
put it in /usr/contrib/bin or /usr/local/bin
But then everybody can get it.
Otherwise give it a meaningful name and use the alias command to set the short name = fullpathname
01-18-2006 11:15 PM
when you write "test", and do not get any error message, you actually execute a (standard) program named test.
"test" is normally located in /usr/bin and probably in yout path; therefor you do not get errors.
It is of course confusing to use a name like that.
01-18-2006 11:27 PM
If you want to start the script in the directory where it stand you need ./ to exucute ./ stand for current directory.
If you just want to start the script int has to stand in the directory which stand in PATH. You can see al these directory's by echo $PATH.
p.s. please give pionts to the one who helped. try to make it 29 0f 29 instead of.
I have assigned points to 8 of 29 responses to my questions.
01-19-2006 12:02 AM
Another bad idea is to make 'test' an alias or a shell-function :)
# which test
might give you that info
Enjoy, Have FUN! H.merijn
01-19-2006 01:54 AM
This reminds me of the very amusing rants of Damian Conway in his Perl Best Practices about unintelligent, unimaginative, lazy, lousy, poor, and evil variable names ;-)
01-19-2006 02:52 AM
Always do the ./scriptname thing when testing a new script. Recall a problem I once had where scp would not work because an application venderput its own script on the path with the name scp.
Owner of ISN Corporation
01-19-2006 05:25 AM
When you are developing a new script you can put it in a new subdirectory and add . as the first line in your PATH variable so it will search your current working directory first.
If in doubt use the which command to see if another program or script is in your path before the one you want.
01-19-2006 06:44 AM
01-19-2006 08:45 PM
test is a ksh command so you have to use ./ to inform the shell that you want to execute your script and not the bulldin command.
rename your script as test.ksh and you can simple test.ksh to invoke it (if you have . in teh PATH).
01-19-2006 09:00 PM
Do following to know what exactly you will be executing.
If you want to execute yout script names test, give full path when starting it.