Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-31-2003, 02:17 AM   #1
LQ Newbie
Registered: Jul 2003
Posts: 16

Rep: Reputation: 0
a simple shell script

cd /etc/rc.d/init.d

it looks so simple,but doesn't work ,who can tell me why?
Old 07-31-2003, 06:01 AM   #2
Registered: Jul 2003
Location: NL
Distribution: My own
Posts: 92

Rep: Reputation: 18
If you would at some extra commands to the script, say the command pwd (print working directory) you would see that the cd command works as expected. But after the script terminates, the calling environment is restored.

If you want to change that in a script, try sourcing it. So use

. scriptname # watch the space after the period

instead of



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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Shell Script Help Kristijan Programming 3 06-13-2005 10:13 PM
Simple shell script mikz Linux - General 1 02-24-2005 08:18 AM
simple shell script sharpie Programming 9 06-03-2004 12:47 AM
Very Simple Shell Script cli_man Linux - Software 5 04-24-2003 11:14 AM
Simple C Shell script is not so simple elconde Programming 2 09-17-2001 12:53 AM

All times are GMT -5. The time now is 05:04 AM.

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