fix parsing of history content

- top_commands_full depends on the history which prefixes some commands
  wiht '*' as the history grows
This commit is contained in:
MorganGeek 2020-07-23 09:21:02 +02:00
parent 1957058cf2
commit a31870d764

View File

@ -132,7 +132,7 @@ function top_commands() {
function top_commands_full() { function top_commands_full() {
local filter="$1" local filter="$1"
local max_results=${2:-'50'} local max_results=${2:-'50'}
history | \cat | awk '{$1=$1};1' | sed 's/^[0-9 TAB]*//g' | awk '{CMD[$0]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "%\t" a; }' G "$filter" | sort --numeric-sort --reverse | nl H "-n$max_results" history | \cat | awk '{$1=$1};1' | sed 's/^[0-9\* TAB]*//g' | awk '{CMD[$0]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "%\t" a; }' G "$filter" | sort --numeric-sort --reverse | nl H "-n$max_results"
} }
# Where is a function defined? # Where is a function defined?
function whichfunc() { function whichfunc() {