Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to display zsh is 32/64 bit?



Thanks, Thomas, it works.
But, because the 'file' utility is not installed on my arch32-light
environment.
So,
I use a more stupid method:
create a symbol file (eg. /opt/arch32/etc/pacman32.conf)

if [ -f /etc/pacm32.conf ] ; then
  PS1="32 "  // in arch32
else
  PS1="64 " // in arch64
fi

2011/12/9 Thomas Köhler <jean-luc@xxxxxxxxxxxxxxxxx>

> Hi Daniel,
>
> Daniel Lin wrote:
> > To do cross compile of 32/64 bit program on one machine.(which installed
> > 64-bit zsh)
> > I use ArchLinux x86_64 as host machine.
> > And a arch32 chroot environment for 32-bit compiling(which installed
> 32-bit
> > zsh).
> >
> > One problem is the PS1 of zsh.
> > It will display the same on both environment.
> > I'm wonder could I show different prompt inside the chroot environemnt?
> >
> > If zsh's prompt variable can deal this?
>
> On Linux, you can simply do something like this:
>
> PS1=$(file -L /proc/$$/exe | sed -e 's/.*ELF //' -e 's/-bit.*/ /')
>
> On my 64 bit (debian derivative) system, that yields a PS1 of "64 ",
> while in the 32 bit (debian) chroot, that yields a PS1 of "32 ".
>
> Ciao,
> Thomas
>
> --
>  Thomas Köhler       Email:       jean-luc@xxxxxxxxxxxxxxxxx
>     <><             WWW:              http://gott-gehabt.de
>                     IRC: tkoehler       Freenode: thkoehler
>                     PGP public key available from Homepage!
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
>
> iD8DBQFO4cETTEYXWMJlHuYRAlEIAJ4tsF/kY8Ldtt25rQFDOuOGNAf44ACffbMf
> WphBIFarW6FTf9X+TiV5Txk=
> =hQ4Q
> -----END PGP SIGNATURE-----
>
>


Messages sorted by: Reverse Date, Date, Thread, Author