Locating shell script files with the $PATH variable


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Locating shell script files with the $PATH variable
# 1  
Old 06-17-2013
Locating shell script files with the $PATH variable

I've created a test script, which is located in $HOME/bin. The script runs as expected with no issues. However, upon echo'ing the $path variable the location of my script is not located in any of the directories listed in $path. So my question is, how does shell know where the script is located if it doesn't check $home/bin?
# 2  
Old 06-17-2013
It does not know where your shell script is if $HOME/bin is not a component in your PATH environmental variable. They only way it can execute your shell script in this case is to provide a relative or absolute pathname.
# 3  
Old 06-17-2013
If it does not know where it is, then how come I can execute the script (or function in my ace) without having to cd in the folder?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to use printf to output a shell variable path?

So I created two shell variables: COLUMN1_HEADING, COLUMN2_HEADING. They have values: COLUMN1_HEADING="John" COLUMN2_HEADING="123456789" How would I use printf to get it to print an output like this: $COLUMN1_HEADING\t$COLUMN2_HEADING\nJohn\t123456789\n Thanks! (3 Replies)
Discussion started by: steezuschrist96
3 Replies

2. Shell Programming and Scripting

Shell FTP script to send all files to different path

Hello to all in forum I hope you can help me. I want to send via FTP to a linux server the 2 kind of files that are in the same folder, as follow: 1- Send all files that are named verified.SomeString.zz.pttp to path /var/verified 2- Send all files where the name begins with verified.conf... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

3. Shell Programming and Scripting

C Shell path variable causing very slow shell!?HELP

I am using C Shell MKS Toolkit and I ran into a huge problem when setting up some environment variables.:confused: The csh script that I have as my login script runs fine but very very slow. When I add a directory to my PATH it seems to slow down shell startup and even slow down the commands. ... (0 Replies)
Discussion started by: vas28r13
0 Replies

4. Shell Programming and Scripting

Running multiple files through shell script with a variable

Ok, so this question is probably much easier than I'm making it, and thus why I've spent almost 2 hours now on this :wall:. I'm trying to use a command that reads out specific data from a file and and saves it to another file. The code is only a few lines, and here it is below: #!/bin/csh ... (4 Replies)
Discussion started by: mysterionRises
4 Replies

5. Shell Programming and Scripting

How to write a shell script to display files in single path?

Hello friends, I am a script which dispalys a multiple files with their contents. for exm: suppose two file test1.txt and test2.txt. when I run my script it have to display the below O/P. test1.txt -rw-r----- 1 sranga staff 91 Sep 23 02:18 calc.sh -rw-r----- 1 sranga ... (2 Replies)
Discussion started by: sivaranga001
2 Replies

6. Shell Programming and Scripting

Recursive call to find files and directories in Shell script from current path.

################################################################ Copy this script to your path from where you want to search for all the files and directories in subdirectories recursively. ################################################################# code starts here... (2 Replies)
Discussion started by: Ramit_Gupta
2 Replies

7. Shell Programming and Scripting

problem in getting the path of environment variable set in bashrc in my shell script

hi all i have joined new to the group. i have set an variable in my bashrc file. .bashrc PROGHOME=/home/braf/braf/prog export PROGHOME but while using it in my shell script its path is not taken and i had to explicitly give the export command to set the path. in my script... (8 Replies)
Discussion started by: krithika
8 Replies

8. Shell Programming and Scripting

Set Path variable in c shell

I set my path environment variable in c shell, using the syntax below setenv PATH "${PATH}:/usr/local:/usr/local/bin" and placed this in $HOME/.login $HOME/.cshrc and /etc/.login /etc/.cshrc but when I issued echo $PATH or set command the output does not reflect changes made to... (5 Replies)
Discussion started by: hassan2
5 Replies
Login or Register to Ask a Question