[linux] pracovny adresar po opusteni mc

Tomas Zatko woody_tz na zoznam.sk
Úterý Březen 23 23:37:43 CET 2004


no. dakujem za poucny cestopis ;-)
pridal som si alias na mc do ~/.bashrc
dik
.t..

On Tuesday 23 March 2004 06:25, 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