add fish config
This commit is contained in:
@@ -129,6 +129,22 @@ function sudo --description "Replacement for sudo that preserves custom PATH com
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function portcheck
|
||||||
|
# 设置起始端口,如果没有传入参数则默认为 8840
|
||||||
|
set -l port 8840
|
||||||
|
if test (count $argv) -gt 0
|
||||||
|
set port $argv[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
# 循环检查端口是否被占用
|
||||||
|
# -t: TCP, -u: UDP, -l: Listening, -n: Numeric
|
||||||
|
while ss -tuln | grep -q ":$port "
|
||||||
|
set port (math $port + 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
echo $port
|
||||||
|
end
|
||||||
|
|
||||||
abbr -a port 'sudo ss -tulnp | grep'
|
abbr -a port 'sudo ss -tulnp | grep'
|
||||||
abbr -a process 'ps aux | grep'
|
abbr -a process 'ps aux | grep'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user