LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-02-2003, 02:01 PM   #1
shahrahulb
LQ Newbie
 
Registered: Jul 2003
Posts: 17

Rep: Reputation: 0
Post cannot execute script file from shell


I have redhat 9.0 linux

Say i have a created small script file:
$cat > temp
pwd
ls

then i made it executable by $chmod +x temp

now if try to execute the file, i get
$temp
bash: temp command not not found.

How can i run the temp file?

also i have installed jdk1.4.0_04.
every time i reboot my system, ihave to export the path as :
export PATH=/usr/java/jd..../bin:$PATH

is there a way to sotre the PATH in some file so that i don't have to export everytime I login.

when i used to work in school, i had save the PATH in
cat $HOME/.profile.

but i am not able to open $HOME/.profile in my home computer with Redhat 9.0.

Your suggestion is highly appreciated.

Thank you very much.

Rahul.
 
Old 08-02-2003, 02:29 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Try:
./temp
 
Old 08-02-2003, 02:30 PM   #3
lfur
Member
 
Registered: Jul 2003
Location: Slovenia
Distribution: Slackware & FreeBSD
Posts: 209

Rep: Reputation: 30
shahrahulb,

I am assuming that you are using BASH shell. To determine this enter:
echo $SHELL

and it will print out the name of your shell.

1.) You have to add:
#!/bin/bash

at the start of the script. You can determine where you bash is with:
whereis bash

If you are using another shell, like csh or ksh, you have to change that ( #!/bin/ksh for example).

2.) You can create a file called .bash_login in your home directory and add:
export PATH=$PATH:/what/ever

Enjoy
 
Old 08-02-2003, 02:31 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
As for the path - try puting it in:
~/.bash_profile
 
Old 03-04-2008, 07:02 AM   #5
potraike
LQ Newbie
 
Registered: Mar 2008
Posts: 4

Rep: Reputation: 0
Angry script executed inside another script dont make changes

Hello,

I have a script B that is executed inside a main script A. The script B make some changes in the environment variables like JAVA_HOME.
When I execute script B in command line everything's fine and the variables are updated.
When I execute script A, apparently the script B outputs the right things but the variables are not updated at the end. I've tried all the ways:

./scriptB.sh
. scriptB.sh
path/to/script/scriptB

please help me!!!!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
auto execute shell script ykirankumar Linux - Software 3 09-22-2004 07:23 AM
shell script won't execute brandnewbie Linux - Newbie 7 08-10-2004 01:30 PM
Remote Win Bat File execute Shell Script on AIX Server DriveMeCrazy AIX 5 05-26-2004 06:24 PM
shell script how to execute x2000koh Programming 6 07-29-2003 04:20 PM


All times are GMT -5. The time now is 11:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration