-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the treasure that adds color to ls should not be used in this case
- Loading branch information
Showing
2 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
if command ls --color >/dev/null 2>/dev/null | ||
then | ||
# standard linux | ||
cat "$(eval_gettext '$MISSION_DIR/treasure-msg/en.txt')" | ||
elif command ls -G >/dev/null 2>/dev/null | ||
then | ||
# freebsd, macOS use another flag for colors: -G | ||
cat "$(eval_gettext '$MISSION_DIR/treasure-msg/en.txt')" | ||
else | ||
# openbsd doesn't use colors at all | ||
: | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
# NOTE: --literal doesn't exist in freebsd | ||
# --color doesn't exist in macos | ||
if ls --literal / &> /dev/null | ||
# --color doesn't exist in macos, it is replaced by -G | ||
# colors do not exist in openbsd! | ||
# | ||
if ls --literal &> /dev/null | ||
then | ||
if ls --color=auto / &> /dev/null | ||
if ls --color=auto &> /dev/null | ||
then | ||
alias ls='ls --literal -p --color=auto' | ||
else | ||
elif ls -G &> /dev/null | ||
then | ||
alias ls='ls --literal -p -G' | ||
fi | ||
else | ||
if ls --color=auto / &> /dev/null | ||
if ls --color=auto &> /dev/null | ||
then | ||
export COLORTERM=1 # necessary for freeBSD | ||
alias ls='ls -p --color=auto' | ||
else | ||
elif ls -G / &> /dev/null | ||
then | ||
alias ls='ls -p -G' | ||
fi | ||
fi |