Article View: ahn.tech.linux
Article #4074Re: shell
From: joseph_a_philbrook__iii
Date: Tue, 24 Nov 1998 00:00
Date: Tue, 24 Nov 1998 00:00
48 lines
2524 bytes
2524 bytes
In article <727ka3$5cv$1@fox.comm.net>, Lil'T <coolrip@petronet.net> wrote:
>go buy some great books at www.cdrom.com cheap
>
Yes that,s ever so helpful... You could at least list one particular
book that you happen to answers Omadawn's question...
>Omadawn wrote in message <725pij$4b0$1@ultra.sonic.net>...
>> So I am new to shell programming and trying to write a script that will
>>change the directoy that I am in.
In an effort to be kind to my fellow newbies in hopes that it will inspire
the real experts into being kind to me when I obviously don't know
something...
Actualy when the script does a cd someplaceelse and exits you are not bumped
back to the current directory because you never left it... the script itself
is like a subshell <I'm sure some real expert could explain how it "forks"
from "your" process...> And when it executes the cd it is the "subshell"
that moves. If the script executes another command before it exits that
command will <basicly> be executed in the directory it cd'd to...
This is definately different from dos where the current working directory
was based on the drive, rather than the process...
Like I said I'm not exactly an expert but this I've done...
If you simply want a command prompt in a directory that your script
will supply for you. The simple solution might be
# cd to predetermined directory
cd someplace
# display the new current diectory
pwd
# print user instruction
echo "esc shell use control-D to return to script control..."
# fork to subshell
sh
# subshell exited with control-D so your back in origianal directory.
Of course there must be a more elegant solution, But I don't know how a
subshell can change the directory of the parrent...
--- ___
<O> <-> Joe (theWordy) Philbrook
^
\___/ < philbrook@lucent.com >
Technical Details
Message-ID:
<73eod8$4r3@nntpa.cb.lucent.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<725pij$4b0$1@ultra.sonic.net> <727ka3$5cv$1@fox.comm.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f906c,fd6b85a931fbd40b X-Google-Attributes: gidf906c,public X-Google-Thread: faa64,fd6b85a931fbd40b X-Google-Attributes: gidfaa64,public X-Google-Thread: 11033e,fd6b85a931fbd40b X-Google-Attributes: gid11033e,public From: mvjap3@mvgsc.mv.lucent.com (joseph_a_philbrook__iii) Subject: Re: shell Date: 1998/11/24 Message-ID: <73eod8$4r3@nntpa.cb.lucent.com> X-Deja-AN: 415212684 References: <725pij$4b0$1@ultra.sonic.net> <727ka3$5cv$1@fox.comm.net> Organization: /app/4.x/cbnetnews/orgqanization Newsgroups: ahn.tech.linux,alt.os.linux,alt.os.linux.slackware