The 'whence' function defined in /etc/profile serves a limited purpose
with Bash as the default shell. Bash already provides
which/type/command as built-ins, which the function simply wraps.
Additionally, zsh has a built-in 'whence' command, which is masked by
the definition in /etc/profile. The function does not work under zsh,
breaking core zsh functionality as a result.
Fixes#18612
Change-Id: Ia34d95ffd58b2cb06d71145a217a9017657fa4a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6979
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Technically the profile is supposed to be sourced, but it seems that
some scenarios / applications do not do this and instead run it.
Before the recent changes to PS1, it was also exported, and now
it is again. Should fix entering HaikuPorter chroots under the new profile.
Also renamed "ARCH" to "_ARCH" to better accomodate those
who are sourcing this file, in case they want to pass a variable
named ARCH through.
As expected there was a lot of bikeshedding.
Just change the color of the path, green on success, red on failure.
Constraints taken into account:
- Keep the > for now
- Prompt should be as compact as possible for those of us using 80
column terminals.
- Prompt should not change size between success and error cases
Not taken into account:
- The feature should be accessible to colorblind people (we could
replace the > with another char but we couldn't find something that
looks suitable)
An example of the new prompt line format is:
~/Desktop/haiku :) $
Or if the last command exited in failure:
~/Desktop/haiku :( $
The smiley-face will be either dark green or red, also depending on
the command status.
I realize this could be a tad controversial, especially for those used
to the old prompt, but it seems to be a pretty useful feature to me
(and of course kallisti5 came up with it.) But if the bikeshed turns
out to be too large, we can revert it and deal with it after the beta.
As for $ vs > -- BeOS R5 used $, most modern Linux uses $, and having >
come after a space looks much stranger.
These changes were made to etc/profile by PulkoMandy last year, but he missed
making the change in SetupEnvironment. etc/profile calls SetupEnvironment,
so we can consolidate all this there.
Also clean up some syntax.
Since hrev51075, locale -m changed meaning to the one expected by POSIX
(it now lists character maps, instead of giving the current language).
Since the short options may change again (locale -c is still not doing
what POSIX requires), use long options instead. This is more readable
and POSIX doesn't specify anything there so we can name them however we
want.
Fixes date parsing in Python which relies on these variables to detect
the current locale.
* This also updates /etc/profile to detect whether our
parent process is a shell, and changes the banner
message accordingly.
* Also, pipe errors to /dev/null, in case grep is not
installed; this allows us to not require grep as a
dependency, and let the banner message do the right
thing.
This allows packages to place files in data/profile.d to manipulate
the shell environment. They could already use settings/etc/profile.d,
but since there's no point in editing those files in most cases, placing
them there nonetheless doesn't make much sense.
ls --color emits the color code irrespective of whether it is being
attached to terminal or not. Which might result in color codes being
added to file upon redirection.
auto option with ls --color emits the color codes only the output is
attached to terminal, otherwise the colors are turned off.
Fixes#8993.
Signed-off-by: Ryan Leavengood <leavengood@gmail.com>
* add support for printing the time-related locale (which may contain
a '@strings=messages' suffix if required by locale configuration
* adjust cmdline params of /bin/locale to be a bit clearer (but keep
support for -c for compatibility)
* adjust /etc/profile to invoke /bin/locale accordingly
The various LC_ environment variables (as well as LANG) are set in
/etc/profile, based on the output of this new simple bin command locale.
LANG and LC_CTYPE are set based on the first preferred language, whereas the
formatting variables are all set based on the formatting conventions language.
The list of LC_ variables are from the locale command on Linux.
Based on my testing, at least the date command obeys these variables.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42394 a95241bf-73f2-0310-859d-f6bbb57e9c96
SetupEnvironment to /etc/profile and use the "id" command. No need to set
SHELL, since the shell sets it anyway. Fixes#5966.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36788 a95241bf-73f2-0310-859d-f6bbb57e9c96
shells started by remote login daemons (sshd, telnetd) also get the
environmental variables defined there. Closes#5789 and #2468.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36536 a95241bf-73f2-0310-859d-f6bbb57e9c96
* enable bash_completion loading in etc/profile. this fixes on the second part #2886.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30233 a95241bf-73f2-0310-859d-f6bbb57e9c96
(aka which) now returns 1 when it cannot find a specified command.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25169 a95241bf-73f2-0310-859d-f6bbb57e9c96