Diff
1diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh
2index 650520797bed1bf1d0d0182b9d9c6ac9cc8cd2d5..eaeba7d2313be12f843ee0ab0249a4c23076207d 100644
3--- a/lib/diagnostics.zsh
4+++ b/lib/diagnostics.zsh
5@@ -335,7 +335,7 @@ function _omz_diag_dump_os_specific_version() {
6 builtin echo "OS Version: $osname $osver build $(sw_vers -buildVersion)"
7 ;;
8 cygwin)
9- command systeminfo | command head -4 | command tail -2
10+ command systeminfo | command head -n 4 | command tail -n 2
11 ;;
12 esac
13
14diff --git a/lib/directories.zsh b/lib/directories.zsh
15index 6696854b0b93802f5e857d91d21acd4ee680bf3c..c62f56468450478ef8213e48662d171bc58677fa 100644
16--- a/lib/directories.zsh
17+++ b/lib/directories.zsh
18@@ -26,7 +26,7 @@ function d () {
19 if [[ -n $1 ]]; then
20 dirs "$@"
21 else
22- dirs -v | head -10
23+ dirs -v | head -n 10
24 fi
25 }
26 compdef _dirs d
27diff --git a/lib/functions.zsh b/lib/functions.zsh
28index 73b491a5951da152fffd5b5fe5088fc16e3d2ea5..fc53611b82649b7fccaa6c4d77d1bc0d06d9ae30 100644
29--- a/lib/functions.zsh
30+++ b/lib/functions.zsh
31@@ -1,7 +1,7 @@
32 function zsh_stats() {
33 fc -l 1 \
34 | awk '{ CMD[$2]++; count++; } END { for (a in CMD) print CMD[a] " " CMD[a]*100/count "% " a }' \
35- | grep -v "./" | sort -nr | head -20 | column -c3 -s " " -t | nl
36+ | grep -v "./" | sort -nr | head -n 20 | column -c3 -s " " -t | nl
37 }
38
39 function uninstall_oh_my_zsh() {
40@@ -45,7 +45,7 @@ function takeurl() {
41 data="$(mktemp)"
42 curl -L "$1" > "$data"
43 tar xf "$data"
44- thedir="$(tar tf "$data" | head -1)"
45+ thedir="$(tar tf "$data" | head -n 1)"
46 rm "$data"
47 cd "$thedir"
48 }
49diff --git a/lib/git.zsh b/lib/git.zsh
50index 9a615e77bbfc2e7cb1dd98e3808e20bb5cd6d8f0..8623473b07f35b38804b66a43ff44756edeb64e6 100644
51--- a/lib/git.zsh
52+++ b/lib/git.zsh
53@@ -51,7 +51,7 @@ function parse_git_dirty() {
54 FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
55 ;;
56 esac
57- STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -1)
58+ STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
59 fi
60 if [[ -n $STATUS ]]; then
61 echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
62diff --git a/plugins/scd/scd b/plugins/scd/scd
63index a7db6c265b935a8f5560fc9d9ad062dc39bacc67..7e9654b441c10c045fb47fe99ca9af0190f3ba9d 100755
64--- a/plugins/scd/scd
65+++ b/plugins/scd/scd
66@@ -270,7 +270,7 @@ fi
67
68 # Determine the last recorded directory
69 if [[ -s ${SCD_HISTFILE} ]]; then
70- last_directory=${"$(tail -1 ${SCD_HISTFILE})"#*;}
71+ last_directory=${"$(tail -n 1 ${SCD_HISTFILE})"#*;}
72 fi
73
74 # The "record" function adds its arguments to the directory index.
75diff --git a/plugins/systemadmin/README.md b/plugins/systemadmin/README.md
76index 052fc6edc131e65099435994431d351b44332af5..146b58605b523227dd28f4fe2d41544fb23e5dcd 100644
77--- a/plugins/systemadmin/README.md
78+++ b/plugins/systemadmin/README.md
79@@ -17,9 +17,9 @@ plugins=(... systemadmin)
80 | path | `print -l $path` | Displays PATH with each entry on a separate line |
81 | mkdir | `mkdir -pv` | Automatically create parent directories and display verbose output |
82 | psmem | `ps -e -orss=,args= \| sort -b -k1 -nr` | Display the processes using the most memory |
83-| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -10` | Display the top 10 processes using the most memory |
84+| psmem10 | `ps -e -orss=,args= \| sort -b -k1 -nr \| head -n 10` | Display the top 10 processes using the most memory |
85 | pscpu | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr` | Display the top processes using the most CPU |
86-| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -10` | Display the top 10 processes using the most CPU |
87+| pscpu10 | `ps -e -o pcpu,cpu,nice,state,cputime,args \|sort -k1 -nr \| head -n 10` | Display the top 10 processes using the most CPU |
88 | hist10 | `print -l ${(o)history%% *} \| uniq -c \| sort -nr \| head -n 10` | Display the top 10 most used commands in the history |
89
90 ## Functions
91diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
92index a77f0069b7bfaecc147477071fbb0ffa4e56def8..2f9d1ef35b42fe1210d2c1b40ffb630c1afe66c7 100644
93--- a/plugins/systemadmin/systemadmin.plugin.zsh
94+++ b/plugins/systemadmin/systemadmin.plugin.zsh
95@@ -26,10 +26,10 @@ alias path='print -l $path'
96 alias mkdir='mkdir -pv'
97 # get top process eating memory
98 alias psmem='ps -e -orss=,args= | sort -b -k1 -nr'
99-alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -10'
100+alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10'
101 # get top process eating cpu if not work try excute : export LC_ALL='C'
102 alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr'
103-alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10'
104+alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10'
105 # top10 of the history
106 alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
107
108@@ -74,7 +74,7 @@ req20() {
109
110 # top20 of Using tcpdump port 80 access to view
111 http20() {
112- sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -20
113+ sudo tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr |head -n 20
114 }
115
116 # top20 of Find time_wait connection
117@@ -99,14 +99,14 @@ accessip10() {
118
119 # top20 of Most Visited file or page
120 visitpage20() {
121- awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -20
122+ awk '{print $11}' "$(retlog)"|sort|uniq -c|sort -nr|head -n 20
123 }
124
125 # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences
126 consume100() {
127- awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100
128+ awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100
129 # if django website or other webiste make by no suffix language
130- # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -100
131+ # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100
132 }
133
134 # Website traffic statistics (G)
135diff --git a/tools/install.sh b/tools/install.sh
136index 7704107c82dbf6ad2d5530d9a4672723a2d98b66..ca996f8a73cab4c62cb976c9bc54a0562d3db8da 100755
137--- a/tools/install.sh
138+++ b/tools/install.sh
139@@ -311,7 +311,7 @@ EOF
140 # 1. Use the most preceding one based on $PATH, then check that it's in the shells file
141 # 2. If that fails, get a zsh path from the shells file, then check it actually exists
142 if ! zsh=$(command -v zsh) || ! grep -qx "$zsh" "$shells_file"; then
143- if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then
144+ if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -n 1) || [ ! -f "$zsh" ]; then
145 fmt_error "no zsh binary found or not present in '$shells_file'"
146 fmt_error "change your default shell manually."
147 return