Jijo Jose A wrote: > I had a bash script and it have the line > > #--------- script begins > cd /usr/share/doc > pwd > exit 0 > #---------- ends > > when i run the code within HOME > it outputs > > /usr/share/doc > > but after i exited from the script ,current directory remains the HOME. > i need to cd through the script .what can i solve this ?
Your script is executed in a subshell, so of course your main shell isn't affected by the change of directory. You could simply source the script instead of executing it in a subshell, but I think a better solution would be to make this an alias. Craig