diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-01 00:48:44 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-09-01 00:48:44 +1200 |
commit | 11a6ae1b208691b9f894ef172c267004cace81e6 (patch) | |
tree | 128344a8d6cea9bee9add353cb75b6c025f68c40 /bash/bashrc.d/ls.bash | |
parent | Fix incorrect array index for VCS states (diff) | |
download | dotfiles-11a6ae1b208691b9f894ef172c267004cace81e6.tar.gz dotfiles-11a6ae1b208691b9f894ef172c267004cace81e6.zip |
More sensible use of local
Don't declare integers/arrays, just use them. Also includes a minor
scope fix -- don't need to count number of colors on every call to
prompt(), just for `prompt on`.
Diffstat (limited to 'bash/bashrc.d/ls.bash')
-rw-r--r-- | bash/bashrc.d/ls.bash | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bash/bashrc.d/ls.bash b/bash/bashrc.d/ls.bash index e74d48d8..a67194b5 100644 --- a/bash/bashrc.d/ls.bash +++ b/bash/bashrc.d/ls.bash @@ -1,15 +1,15 @@ # Function returns calculated options for ls lsopts() { - # Declare options array - local -a lsopts - # Snarf the output of `ls --help` into a variable local lshelp=$(ls --help 2>/dev/null) + # Start collecting available options + local lsopts=() + # If the --color option is available and we have a terminal that supports # at least eight colors, add --color=auto to the options - local -i colors=$(tput colors) + local colors=$(tput colors) if [[ $lshelp == *--color* ]] && ((colors >= 8)); then lsopts[${#lsopts[@]}]='--color=auto' fi |