mirror of
https://codeberg.org/vlw/dotfiles.git
synced 2026-01-11 21:36:00 +01:00
feat(bash): run ls for symlink and binary files with l
This commit is contained in:
parent
5dfd6cebaa
commit
b01adfcbbb
1 changed files with 13 additions and 0 deletions
|
|
@ -17,6 +17,19 @@ l () {
|
||||||
local target="${1:-$(pwd)}"
|
local target="${1:-$(pwd)}"
|
||||||
|
|
||||||
if [ -f $target ] ; then
|
if [ -f $target ] ; then
|
||||||
|
# Target is not a text file
|
||||||
|
if [ -L $target ] || grep -q -P "[^\x00-\x7F]" $target; then
|
||||||
|
ls -lah $target
|
||||||
|
|
||||||
|
# Target is not a symlink, so it must be binary
|
||||||
|
if [ ! -L $target ]; then
|
||||||
|
echo ""
|
||||||
|
echo -e "\033[96mBinary file. Run 'll $target' to preview anyways.\e[0m"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
less $target
|
less $target
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue