![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Command not working | preethgideon | UNIX for Dummies Questions & Answers | 3 | 05-14-2008 08:56 AM |
| why is this command not working? | wrapster | UNIX for Advanced & Expert Users | 1 | 05-02-2008 06:11 AM |
| Sed command not working | shashi_kiran_v | UNIX for Dummies Questions & Answers | 9 | 11-14-2006 09:01 PM |
| cp command not working | groundlevel | UNIX for Dummies Questions & Answers | 7 | 03-22-2006 10:48 AM |
| last command not working | antalexi | SUN Solaris | 3 | 08-04-2005 07:22 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
cd command not working
Hello,
I am facing a strange problem while writing a script in ksh .... though the script is too long but whenever i try to change the path to new path , the path is not changed... like the path is : ?pwd /osp/linus ?more script echo "hello" cd /osp echo "bye" ?sh script hello bye ? pwd /osp/linus I tried all possible reasons , I am able to change via using a simple cd command but not via using it in a script........ Pls suggest what can be the possible reasons.... thanks in advance..... Aparna |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
. script |
|
#3
|
|||
|
|||
|
Hello
Pls specify what is .script .......
i tried to execute the script by that but is not working....... Pls advice and elaborate... Thks again.... Aparna |
|
#4
|
||||
|
||||
|
Quote:
Code:
?more script echo "hello" cd /osp echo "bye" Code:
. script |
|
#5
|
||||
|
||||
|
Some shells may require that "." is in your PATH, so you may need to do
Code:
. ./script |
|
#6
|
|||
|
|||
|
Hi
Thanks it worked but I am curiuos to know why it happened ? i mean why i didnt worked with sh and wirked with bot .script and . ./script.....
what is reason for this behaviour... Thks again Aparna |
|
#7
|
||||
|
||||
|
The first . means execute in the current shell. The second ./ means execute the binary present in the present working directory.
Sometimes your PATH variable has your present directory preceeded by other directories in which case you dont need the ./ eun echo $PATH and then you can decide whether you want to use a ./ or not.
__________________
War doesnt determine who is right, it determines who is left |
||||
| Google The UNIX and Linux Forums |