zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Lin <dlin.tw@gmail.com>
To: Daniel Lin <dlin.tw@gmail.com>,
	Bart Schaefer <schaefer@brasslantern.com>,
	 Zsh Users <zsh-users@zsh.org>
Subject: Re: How to display zsh is 32/64 bit?
Date: Fri, 9 Dec 2011 16:44:36 +0800	[thread overview]
Message-ID: <CAPg-njzrj6St8tbC2aQK2utn5zY39gYVOOHdJfy-BaW4yHgNfQ@mail.gmail.com> (raw)
In-Reply-To: <20111209080435.GA29537@picard.franken.de>

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

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@picard.franken.de>

> 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@picard.franken.de
>     <><             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-----
>
>

  reply	other threads:[~2011-12-09  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09  4:34 Daniel Lin
2011-12-09  8:04 ` Thomas Köhler
2011-12-09  8:44   ` Daniel Lin [this message]
2011-12-09 13:49 ` Peter Stephenson
2011-12-09 15:38   ` Dan Nelson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPg-njzrj6St8tbC2aQK2utn5zY39gYVOOHdJfy-BaW4yHgNfQ@mail.gmail.com \
    --to=dlin.tw@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).