[linux] script cdback cd.to.previous.dir *was* Re: [linux] pracovny adresar po opusteni mc

Peto - www.lentus.sk konfery na lentus.sk
Úterý Březen 23 19:44:13 CET 2004


Ahoj.
OK, nieco podobne potrebujem aj ja v zsh {resp. kvoli univerzalnosti v 
bash/tcsh}.

1. Existuje nejaky prikaz/opsna pre cd --back [nieco ADVANCED v zsh?]
{
cd /4/232/3434/5465
cd
ooops, zase
cd /4/232/3434/5465 [namiesto tohto, radsej cd --back  -> najma, ak si 
nepmatam, kde som vlastne bol]
}

2. vid 1 s tym, ze to pojde aj v bashi a tcsh?
{keby sa niekomu xcelo urobit script, myslim, ze vela ludi by to ocenilo :)}


Dik

Peto





Peter Mann wrote:

> On Tue, Mar 23, 2004 at 01:19:02AM +0100, Tomas Zatko wrote:
> 
>>Pri mdk som bol zvyknuty, ze ked sa v mc dostanem do
>>/velmi/zahrabaneho/folderu
>>a potom ukoncim mc, ze v tomto folderi zostanem.
>>
>>Nikdy som sa nezamyslal ako toto "udelatko" funguje, ale teraz by sa mi 
>>to vediet naramne zislo ;-)
>>Debian Sarge
> 
> 
> ako postupovat v takychto pripadoch:
> 
> pozri si /usr/share/doc/mc/README.Debian:
> 
> If you want to learn some interesting usage tips, you should read the
> Midnight Commander FAQ (/usr/share/doc/mc/FAQ, also available through
> the Debian doc-base interface).
> 
> takze pokracujeme na /usr/share/doc/mc/FAQ.gz (dal som hladat "dir")
> 
> a tam je:
> 
> 6.1 How do I stay in the last directory when I exit Midnight Commander?
> 
>    See the description of the -P option in the Options section of the
>    manual.
> 
> takze ideme dalej: man mc
> 
>        -P file, --printwd=file
>               	Print the last working directory to the specified file.
> 		This option is not meant to be used directly.  Instead, 
> 		it's used from a special shell script that automatically 
> 		changes the current directory of the shell to the last 
> 		directory the Midnight Commander was  in.   Source  the
> 		file  /usr/share/mc/bin/mc.sh (bash and zsh users) or 
> 		/usr/share/mc/bin/mc.csh (tcsh users) respectively to 
> 		define mc as an alias to the appropriate shell script.
> 
> 
> cat /usr/share/mc/bin/mc.sh
> alias mc='. /usr/share/mc/bin/mc-wrapper.sh'
> 
> 
> cat /usr/share/mc/bin/mc-wrapper.sh
> MC_USER=`id | sed 's/[^(]*(//;s/).*//'`
> MC_PWD_FILE="${TMPDIR-/tmp}/mc-$MC_USER/mc.pwd.$$"
> /usr/bin/mc -P "$MC_PWD_FILE" "$@"
> 
> if test -r "$MC_PWD_FILE"; then
> 	MC_PWD="`cat $MC_PWD_FILE`"
> 	if test -n "$MC_PWD" && test -d "$MC_PWD"; then
> 		cd "$MC_PWD"
> 	fi
> 	unset MC_PWD
> fi
> 
> rm -f "$MC_PWD_FILE"
> unset MC_PWD_FILE
> 
> 
> hotovo ;-))
> 




Další informace o konferenci linux