Share your knowledge at the LQ Wiki.
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, 01: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, 05: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 09:13 PM
Simple shell script mikz Linux - General 1 02-24-2005 07:18 AM
simple shell script sharpie Programming 9 06-02-2004 11:47 PM
Very Simple Shell Script cli_man Linux - Software 5 04-24-2003 10:14 AM
Simple C Shell script is not so simple elconde Programming 2 09-16-2001 11:53 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:15 PM.

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
Open Source Consulting | Domain Registration