Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-05-2012
Registered User
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Script not executing

Hello,

I wasn't sure where to post this so I posted it here. I've used UNIX quite a bit, LINUX not so much. For some reason, my LINUX script will not execute if I type in the script name and press enter. I'm in the directory where the script is.

test.sh

However, when I use ". ./" it executes fine. I was wondering why this is and what I need to do to have it execute at the command prompt without the ". ./".

. ./test.sh

This is part of a bigger question and issue I'm having which I'm not looking to resolve here. I'm trying to install Informatica 9.1 onto a LINUX RedHat platform. The install script wouldn't run when I typed in install.sh. When I ran it with ". ./install.sh a number of error messages popped up and the install hung. I'm working with Informatica Support on this.

Regards, Jim
Sponsored Links
    #2  
Old 04-05-2012
methyl methyl is offline Forum Staff  
Moderator
 
Join Date: Mar 2008
Posts: 6,388
Thanks: 286
Thanked 668 Times in 640 Posts
Shouldn't that be

Code:
./test.sh

Or

Code:
/fullpath_to_script/test.sh

The reason your script won't execute as just test.sh is because the directory containing the script is not in $PATH . Your other system may have had . in $PATH (i.e. any current directory) which is a big security risk.
Sponsored Links
    #3  
Old 04-05-2012
Registered User
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Thanks

Thank you,

I didn't notice that this system when I did an "ls", did not have a '.' or a ".." directory. I do remember other systems I've worked on did have those directories. That certainly makes sense now.

Regards, Jim
    #4  
Old 04-05-2012
Mead Rotor
 
Join Date: Aug 2005
Location: Saskatchewan
Posts: 16,371
Thanks: 490
Thanked 2,534 Times in 2,417 Posts
. and .. definitely exist in Linux too, though ls may not show them. They have the usual meaning, current folder and previous folder.
Sponsored Links
    #5  
Old 04-05-2012
methyl methyl is offline Forum Staff  
Moderator
 
Join Date: Mar 2008
Posts: 6,388
Thanks: 286
Thanked 668 Times in 640 Posts
You may be misunderstanding me about $PATH .

Try this command to show you the contents of the standard $PATH variable. It lists all the directories in order which the Operating System will search when looking for a program or executable script. If the variable $PATH contains . (current directory) then it will also look in whatever is the current directory.

Code:
echo "${PATH}"

The . and .. directories are always there.
Try:

Code:
ls -la

Sponsored Links
    #6  
Old 04-06-2012
Registered User
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Thanks for the help again...
The Following User Says Thank You to jsanders For This Useful Post:
methyl (04-06-2012)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with executing script pawannoel UNIX for Dummies Questions & Answers 6 03-25-2011 11:50 AM
Variables of executed script available in executing script dips_ag Shell Programming and Scripting 9 05-11-2010 11:54 PM
Executing a shell script from windows;script present in unix rajneesh_kapoor UNIX for Advanced & Expert Users 4 05-08-2009 02:54 PM
[AIX] executing script piooooter UNIX for Dummies Questions & Answers 1 05-26-2006 12:53 AM
script not executing dreams5617 Shell Programming and Scripting 3 12-06-2004 04:15 PM



All times are GMT -4. The time now is 12:57 AM.