Let's be MacOS compatible.

This commit is contained in:
Doncho N. Gunchev 2024-04-26 15:13:11 +03:00
parent 3f8ffe86c9
commit 487eb012d0
Signed by: dgunchev
GPG key ID: D30FD19F37E002A9
3 changed files with 14 additions and 5 deletions

View file

@ -6,8 +6,14 @@ fi
# show hidden files and directories
alias l.='ls -d .[^.]* ..?* --color=tty 2>/dev/null'
# long format with ISO dates
alias lll='ls -Al "--time-style=+%Y-%m-%d %H:%M:%S %4Z"'
if ! which ll 2>/dev/null; then
alias ll='ls -l --color=auto'
fi
if [[ "$OSTYPE" != darwin* ]]; then
# long format with ISO dates
alias lll='ls -Al "--time-style=+%Y-%m-%d %H:%M:%S %4Z"'
fi
# color less (restricted)
alias less='less -R'

View file

@ -52,7 +52,7 @@ if [ "$PS1" ] ; then # interactive shell detection
# Log the logout event.
function prompt_command_exit() {
trap - EXIT
local now=$(date --rfc-3339=ns)
local now=$(date --rfc-3339=ns 2> /dev/null || date -Iseconds)
local HistFile
HistFile="$HOME/bash_history/$(date '+%Y-%m/%Y-%m-%d')"
mkdir -p "${HistFile%/*}"
@ -61,7 +61,7 @@ function prompt_command_exit() {
# Executed before each prompt. Fill the variables needed by PS1 here.
function prompt_command() {
local now=$(date --rfc-3339=ns)
local now=$(date --rfc-3339=ns 2> /dev/null || date -Iseconds)
# Manage the history
local HistFile="$HOME/bash_history/$(date '+%Y-%m/%Y-%m-%d')"

View file

@ -1,6 +1,6 @@
Summary: Gwebu profile.d - cool date, prompt with history, aliases
Name: gwebu-profile
Version: 1.0.1
Version: 1.0.2
Release: 0
BuildArch: noarch
License: GPLv2
@ -41,6 +41,9 @@ install -m 0644 etc/profile.d/*.sh %{buildroot}%{_sysconfdir}/profile.d/
%changelog
* Fri Apr 26 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.2-0
- Let's be MacOS compatible.
* Wed Apr 03 2024 Doncho N. Gunchev <dgunchev@gmail.com> - 1.0.1-0
- Fix ip color on EL 7.