From 487eb012d02558ef1ab769c56a28d8a338386c35 Mon Sep 17 00:00:00 2001 From: "Doncho N. Gunchev" Date: Fri, 26 Apr 2024 15:13:11 +0300 Subject: [PATCH] Let's be MacOS compatible. --- etc/profile.d/z-aliases.sh | 10 ++++++++-- etc/profile.d/z-ps-twtty-7.sh | 4 ++-- gwebu-profile.spec.in | 5 ++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/etc/profile.d/z-aliases.sh b/etc/profile.d/z-aliases.sh index cdf9a23..c9541af 100755 --- a/etc/profile.d/z-aliases.sh +++ b/etc/profile.d/z-aliases.sh @@ -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' diff --git a/etc/profile.d/z-ps-twtty-7.sh b/etc/profile.d/z-ps-twtty-7.sh index de02975..5d1044a 100755 --- a/etc/profile.d/z-ps-twtty-7.sh +++ b/etc/profile.d/z-ps-twtty-7.sh @@ -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')" diff --git a/gwebu-profile.spec.in b/gwebu-profile.spec.in index 1fcd030..cee66fa 100644 --- a/gwebu-profile.spec.in +++ b/gwebu-profile.spec.in @@ -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 - 1.0.2-0 +- Let's be MacOS compatible. + * Wed Apr 03 2024 Doncho N. Gunchev - 1.0.1-0 - Fix ip color on EL 7.