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')"