a) you're in a Gentoo-system (ie chrooted from a livecd or booted into one)?
b) since when does this happen? has it ever worked correctly?
c) what do the following commands return?

Code:

emerge --version ; echo $?

Code:

which emerge

Code:

file `which emerge`

d) if it ever worked, please upload /var/log/emerge.log - or past the last ~100 lines_________________++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

Actually the last thing I did - now that I remember - was update the system and run revdep-rebuild and then emerge --depclean and I got a lot of errors but I didn't pay attention I just shut down cause I had to go. Anyways I was looking the emerge.log and portage log and this is what I had. had to use nano to view the logs cause vi returned me this:

WARN: postinst
Old versions of installed libraries were detected on your system.
In order to avoid breaking packages that depend on these old libs,
the libraries are not being removed. You need to run revdep-rebuild
in order to remove these old dependencies. If you do not have this
helper program, simply emerge the 'gentoolkit' package.

# revdep-rebuild --library '/usr/lib/libnotify.so.1'

Once you've finished running revdep-rebuild, it should be safe to
delete the old libraries. Here is a copy & paste for the lazy:
# rm '/usr/lib/libnotify.so.1'

ERROR: postrm
The ebuild phase 'postrm' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.
The 'postrm' phase of the 'dev-lang/python-2.6.6-r2' package has failed
with exit value 1.

The problem occurred while executing the ebuild file named
'python-2.6.6-r2.ebuild' located in the '/var/db/pkg/dev-
lang/python-2.6.6-r2' directory. If necessary, manually remove the
environment.bz2 file and/or the ebuild file located in that directory.

Removal of the environment.bz2 file is preferred since it may allow the
removal phases to execute successfully. The ebuild will be sourced and
the eclasses from the current portage tree will be used when necessary.
Removal of the ebuild file will cause the pkg_prerm() and pkg_postrm()
removal phases to be skipped entirely.
ERROR: dev-lang/python-2.6.6-r2 failed (postrm phase):
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-lang/python-2.6.6-r2',
the complete build log and the output of 'emerge -pqv =dev-lang/python-2.6.6-r2'.
The complete build log is located at '/var/tmp/binpkgs/dev-lang/python-2.6.6-r2/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-lang/python-2.6.6-r2/temp/environment'.
S: '/var/tmp/binpkgs/dev-lang/python-2.6.6-r2/work/python-2.6.6'

If you need support, post the output of 'emerge --info =dev-lang/python-2.6.6-r2',
the complete build log and the output of 'emerge -pqv =dev-lang/python-2.6.6-r2'.
This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'
The complete build log is located at '/var/tmp/binpkgs/dev-lang/python-2.6.6-r2/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-lang/python-2.6.6-r2/temp/environment'.
S: '/var/tmp/binpkgs/dev-lang/python-2.6.6-r2/work/python-2.6.6'

ERROR: prerm
The ebuild phase 'prerm' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.
ERROR: dev-cpp/cairomm-1.8.6 failed (prerm phase):
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-cpp/cairomm-1.8.6',
the complete build log and the output of 'emerge -pqv =dev-cpp/cairomm-1.8.6'.
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/work/cairomm-1.8.6'

ERROR: postrm
The ebuild phase 'postrm' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.
The 'postrm' phase of the 'dev-cpp/cairomm-1.8.6' package has failed
with exit value 1.

The problem occurred while executing the ebuild file named
'cairomm-1.8.6.ebuild' located in the '/var/db/pkg/dev-
cpp/cairomm-1.8.6' directory. If necessary, manually remove the
environment.bz2 file and/or the ebuild file located in that directory.

Removal of the environment.bz2 file is preferred since it may allow the
removal phases to execute successfully. The ebuild will be sourced and
the eclasses from the current portage tree will be used when necessary.
Removal of the ebuild file will cause the pkg_prerm() and pkg_postrm()
removal phases to be skipped entirely.
ERROR: dev-cpp/cairomm-1.8.6 failed (postrm phase):
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-cpp/cairomm-1.8.6',
the complete build log and the output of 'emerge -pqv =dev-cpp/cairomm-1.8.6'.
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/work/cairomm-1.8.6'

If you need support, post the output of 'emerge --info =dev-cpp/cairomm-1.8.6',
the complete build log and the output of 'emerge -pqv =dev-cpp/cairomm-1.8.6'.
This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/work/cairomm-1.8.6'
ERROR: dev-cpp/cairomm-1.8.6 failed:
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-cpp/cairomm-1.8.6',
the complete build log and the output of 'emerge -pqv =dev-cpp/cairomm-1.8.6'.
This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/cairomm-1.8.6/work/cairomm-1.8.6'

ERROR: prerm
The ebuild phase 'prerm' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.
ERROR: dev-cpp/glibmm-2.24.2-r1 failed (prerm phase):
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-cpp/glibmm-2.24.2-r1',
the complete build log and the output of 'emerge -pqv =dev-cpp/glibmm-2.24.2-r1'.
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/work/glibmm-2.24.2'

ERROR: postrm
The ebuild phase 'postrm' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.
The 'postrm' phase of the 'dev-cpp/glibmm-2.24.2-r1' package has failed
with exit value 1.

The problem occurred while executing the ebuild file named
'glibmm-2.24.2-r1.ebuild' located in the '/var/db/pkg/dev-
cpp/glibmm-2.24.2-r1' directory. If necessary, manually remove the
environment.bz2 file and/or the ebuild file located in that directory.

Removal of the environment.bz2 file is preferred since it may allow the
removal phases to execute successfully. The ebuild will be sourced and
the eclasses from the current portage tree will be used when necessary.
Removal of the ebuild file will cause the pkg_prerm() and pkg_postrm()
removal phases to be skipped entirely.
ERROR: dev-cpp/glibmm-2.24.2-r1 failed (postrm phase):
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-cpp/glibmm-2.24.2-r1',
the complete build log and the output of 'emerge -pqv =dev-cpp/glibmm-2.24.2-r1'.
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/work/glibmm-2.24.2'

If you need support, post the output of 'emerge --info =dev-cpp/glibmm-2.24.2-r1',
the complete build log and the output of 'emerge -pqv =dev-cpp/glibmm-2.24.2-r1'.
This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/work/glibmm-2.24.2'
ERROR: dev-cpp/glibmm-2.24.2-r1 failed:
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-cpp/glibmm-2.24.2-r1',
the complete build log and the output of 'emerge -pqv =dev-cpp/glibmm-2.24.2-r1'.
This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'
The complete build log is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/temp/environment'.
S: '/var/tmp/binpkgs/dev-cpp/glibmm-2.24.2-r1/work/glibmm-2.24.2'

ERROR: prerm
The ebuild phase 'prerm' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.
ERROR: dev-libs/libsigc++-2.2.7 failed (prerm phase):
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-libs/libsigc++-2.2.7',
the complete build log and the output of 'emerge -pqv =dev-libs/libsigc++-2.2.7'.
The complete build log is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/environment'.
S: '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/work/libsigc++-2.2.7'

ERROR: postrm
The ebuild phase 'postrm' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.
The 'postrm' phase of the 'dev-libs/libsigc++-2.2.7' package has failed
with exit value 1.

The problem occurred while executing the ebuild file named
'libsigc++-2.2.7.ebuild' located in the '/var/db/pkg/dev-
libs/libsigc++-2.2.7' directory. If necessary, manually remove the
environment.bz2 file and/or the ebuild file located in that directory.

Removal of the environment.bz2 file is preferred since it may allow the
removal phases to execute successfully. The ebuild will be sourced and
the eclasses from the current portage tree will be used when necessary.
Removal of the ebuild file will cause the pkg_prerm() and pkg_postrm()
removal phases to be skipped entirely.
ERROR: dev-libs/libsigc++-2.2.7 failed (postrm phase):
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-libs/libsigc++-2.2.7',
the complete build log and the output of 'emerge -pqv =dev-libs/libsigc++-2.2.7'.
The complete build log is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/environment'.
S: '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/work/libsigc++-2.2.7'

If you need support, post the output of 'emerge --info =dev-libs/libsigc++-2.2.7',
the complete build log and the output of 'emerge -pqv =dev-libs/libsigc++-2.2.7'.
This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'
The complete build log is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/environment'.
S: '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/work/libsigc++-2.2.7'
ERROR: dev-libs/libsigc++-2.2.7 failed:
filter-bash-environment.py failed

If you need support, post the output of 'emerge --info =dev-libs/libsigc++-2.2.7',
the complete build log and the output of 'emerge -pqv =dev-libs/libsigc++-2.2.7'.
This ebuild is from an overlay named 'gentoo': '/var/db/pkg/'
The complete build log is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/build.log'.
The ebuild environment file is located at '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/temp/environment'.
S: '/var/tmp/binpkgs/dev-libs/libsigc++-2.2.7/work/libsigc++-2.2.7'