Commit Graph

34 Commits

Author SHA1 Message Date
Zach Dykstra
26d22ee8dc shell: remove extraneous/conflicting function
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>
2023-10-04 16:53:30 +00:00
Augustin Cavalier
57ab322d67 profile: export PS1, don't just set it.
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.
2018-10-27 14:03:44 -04:00
Adrien Destugues
abb35d283f Fix escaping of escape codes.
Without this, readline will compute the length of the prompt
incorrectly, leading to display artifacts.
2018-08-23 20:27:58 +02:00
Adrien Destugues
9a152c9cb0 Change the prompt again.
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)
2018-08-23 17:51:21 +02:00
Augustin Cavalier
9d1582e31a etc/profile: Add kallisti5's smiley-face $? indicator and use $ not >.
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.
2018-08-21 21:13:51 -04:00
François Revol
e4fac18200 data/profile: fix and simplify secondary arch detection
The previous code was wrong: running bash --login was reported
as if we used setarch x86_gcc2.

Current code also saves 3 fork+exec.
2018-08-21 23:26:33 +02:00
Augustin Cavalier
bddcee2a27 data: Fix locale setup in SetupEnvironment and remove it from etc/profile.
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.
2018-08-21 17:01:53 -04:00
Adrien Destugues
5f4f984a94 etc/profile: Fix setting of LC_* variables
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.
2017-11-23 14:50:11 +01:00
Thorsten „mirabilos“ Glaser
be9a70562e Make /etc/profile compatible with non-bash shells again.
Fixes #13384.

Signed-off-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2017-03-25 12:04:08 +01:00
Adrien Destugues
3c08adef21 Add architecture to prompt when in getarch context.
Fixes #10687.
2016-09-17 18:06:41 +02:00
Jessica Hamilton
0975f16f7c setarch: use a login shell; fixes #12066.
* 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.
2015-06-12 19:29:19 +12:00
Axel Dörfler
a2d9c45398 profile: enlarged HISTFILESIZE to 500.
* 50 isn't really contemporary anymore.
2015-03-24 22:41:52 +00:00
Ingo Weinhold
be012e2122 /etc/profile: Also source profile.d/*.sh files in data dirs
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.
2013-12-04 23:21:14 +01:00
Prasad Joshi
4fd62caa9a bash_profile: set ls color alias to auto
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>
2012-10-03 15:23:57 -04:00
Oliver Tappe
98057dd02a Adjust /bin/locale to print time-related locale, too.
* 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
2012-02-23 23:15:36 +01:00
Ryan Leavengood
ff37608cc3 Remove unneeded LC_ environment variables which are glibc extensions not
supported by Haiku's locale system. Thanks Oliver.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42400 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-07-09 17:25:22 +00:00
Ryan Leavengood
83a30ba91e Implement #7495 as per Matt and Ingo's suggestions.
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
2011-07-09 04:29:20 +00:00
Brecht Machiels
4a135b33b7 * upgraded bash_completion to v1.3
* upgraded to subversion bash completion script shipped with subversion 1.6.17
* added git bash completion script shipped with git 1.7.5.4
* readded bash completion to the image

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42257 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-19 21:19:36 +00:00
Ingo Weinhold
e4a4fcc9fb Moved definitions of the USER and GROUP environmental variables from
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
2010-05-11 14:55:23 +00:00
Ingo Weinhold
2dbf8cd728 Source SetupEnvironment with the more portable ".".
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36537 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-04-29 18:15:41 +00:00
Ingo Weinhold
f1a61cda9a Typo-fixed patch by mjw: Include SetupEnvironment from /etc/profile, so
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
2010-04-29 16:47:05 +00:00
Michael Lotz
d280260742 Add export to our default profile to ignore duplicate history entries.
Fixes enhancement #4156.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31953 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-29 23:49:16 +00:00
Axel Dörfler
9532f6844f * Removed the "cd" to home in /etc/profile, made sure that Tracker/Deskbar are
started from /boot/home. This closes ticket #3090.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30674 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-08 14:29:29 +00:00
Jérôme Duval
07a283fec3 * added bash_completion 20060301, it should be cleaned up.
* 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
2009-04-17 22:05:11 +00:00
Axel Dörfler
f70cad5cf8 * Added "shopt -s checkwinsize" to our /etc/profile. This fixes bug #2514,
thanks Adrian!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28772 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-12-03 21:23:04 +00:00
Ingo Weinhold
9b0eb8c8f4 Removed "lal" alias and added "-A" to "ll" instead.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28193 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-16 21:34:15 +00:00
Ingo Weinhold
96490327ca Removed superfluous and wrong (history forward and backward search was
swapped) key bindings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26026 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-06-19 14:25:26 +00:00
François Revol
0dacda17d5 A space after the prompt really helps selecting only the command with double-click in Terminal.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25185 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-04-26 15:56:01 +00:00
Ingo Weinhold
425b1199b0 I don't know, if that makes is less almost-ksh compatible, but whence
(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
2008-04-26 00:50:21 +00:00
François Revol
4d49ac789d Added my most used aliases: m=more and lal=ls -lA.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24112 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-25 13:19:29 +00:00
Axel Dörfler
a381c8a063 Added more or less standard aliases for "ls -l" (ll) and "ls -A" (la).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24111 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-02-25 12:52:16 +00:00
Axel Dörfler
3955cf3678 We're now using the --color option for "ls" by default which enables
colored output on capable terminals.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11353 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-12 04:05:27 +00:00
Axel Dörfler
0c7e169a8c Forgot to switch to the home directory.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-12 16:45:14 +00:00
Axel Dörfler
1583190bd8 Added initial version of some scripts for the boot process.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9776 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-03 16:36:40 +00:00