From f5fd9473c5f2b73b1ae2d2525e92072e97194883 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Sun, 17 Feb 2019 18:11:05 +0330 Subject: [PATCH] fix: review and fix maxos issues --- 1bash.d/0_colors.sh | 7 ++++++- 1bash.d/aliases.sh | 8 ++++++-- 1bash.sh | 4 ---- logo.txt | 1 + profile | 5 +++++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/1bash.d/0_colors.sh b/1bash.d/0_colors.sh index 15f0145..ca13dd2 100644 --- a/1bash.d/0_colors.sh +++ b/1bash.d/0_colors.sh @@ -6,7 +6,12 @@ elif [ -f $ONE_BASH/dircolors ]; then eval "$( dircolors -b $ONE_BASH/dircolors )" fi -if ls --color=auto > /dev/null 2>&1; then colorflag="--color=auto"; else colorflag="-G"; fi; +# Detect which `ls` flavor is in use +if ls --color > /dev/null 2>&1; then # GNU `ls` + colorflag="--color" +else # OS X `ls` + colorflag="-G" +fi # enable color support of ls and also add handy aliases alias ls='ls $colorflag' diff --git a/1bash.d/aliases.sh b/1bash.d/aliases.sh index 2b76a3e..0af7e78 100644 --- a/1bash.d/aliases.sh +++ b/1bash.d/aliases.sh @@ -24,8 +24,12 @@ alias where=which # sometimes i forget # export CLICOLOR_FORCE=1 # ls options: A = include hidden (but not . or ..), F = put `/` after folders, h = byte unit suffixes -alias lsa="ls -lAhF --group-directories-first" -alias lsd="ls | grep '^d'" # only directories +if lsa --group-directories-first > /dev/null 2>&1; then # GNU `ls` + alias lsa="ls -lAhF --group-directories-first" +else # OS X `ls` + alias lsa="ls -lAhF" +fi +alias lsd="ls | grep --color=never '^d'" # only directories # `la` defined in .functions # `cat` with beautiful colors. requires: sudo easy_install -U Pygments diff --git a/1bash.sh b/1bash.sh index 1580f76..0519a27 100644 --- a/1bash.sh +++ b/1bash.sh @@ -26,7 +26,3 @@ for i in $ONE_BASH/1bash.d/*.sh; do fi done unset i - -if ! shopt -oq posix; then - lsa -fi diff --git a/logo.txt b/logo.txt index 141ed2b..1d0934e 100644 --- a/logo.txt +++ b/logo.txt @@ -1,3 +1,4 @@ + bbbbbbbb 1111111 b::::::b hhhhhhh 1::::::1 b::::::b h:::::h diff --git a/profile b/profile index fe56a85..d1f8552 100644 --- a/profile +++ b/profile @@ -11,4 +11,9 @@ if [ "$BASH" ]; then # if [ -f ~/.bashrc ]; then # . ~/.bashrc # fi + + # if ! shopt -oq posix; then + # cd /srv + # lsa + # fi fi \ No newline at end of file