[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] cd erstatning



Jacob Sparre Andersen <sslug@sslug> writes:

>> ala
>>
>>   alias chdir="exec $HOME/bin/chdir"
>>
>> ind i sin .bashrc
>
> Jeg kan ikke lige regne ud hvilken effekt det vil have.  Må vi få det
> forklaret?  (så skal jeg nok hjælpe med at drikke Corsendonken)

Det gør illusionen lidt mere overbevisende:

sslug@sslug:~$ echo pid: $$    Antal shell: $SHLVL
pid: 21370 Antal shell: 2
sslug@sslug:~$ /tmp/chdir .
Trying to change directory to .
Directory succesfulled changed to /home/brother
sslug@sslug:~$ echo pid: $$    Antal shell: $SHLVL
pid: 21389 Antal shell: 3
sslug@sslug:~$ exit
exit
sslug@sslug:~$ echo pid: $$    Antal shell: $SHLVL
pid: 21370 Antal shell: 2
sslug@sslug:~$ exec /tmp/chdir .
Trying to change directory to .
Directory succesfulled changed to /home/brother
sslug@sslug:~$ echo pid: $$    Antal shell: $SHLVL
pid: 21370 Antal shell: 2
sslug@sslug:~$ 

Istedet for at kalde et program der erstatter sig selv med en shell,
så erstatter vi den eksisterende shell med et program der erstatter
sig med en shell.

Prøv også at følge med i pstree hvad der sker.

-- 
 Peter Makholm     |    Yes, you can fight it, but in the end the ultimate
 sslug@sslug |                           goal of life is to have fun
 http://hacking.dk |                                     -- Linus Torvalds


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-01-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *