文件操作 - lib.sh
返回文件管理
返回主菜单
删除本文件
文件: /usr/src/linux-headers-5.15.0-186/tools/testing/selftests/net/lib.sh
编辑文件内容
#!/bin/bash # SPDX-License-Identifier: GPL-2.0 loopy_wait() { local sleep_cmd=$1; shift local timeout_ms=$1; shift local start_time="$(date -u +%s%3N)" while true do local out if out=$("$@"); then echo -n "$out" return 0 fi local current_time="$(date -u +%s%3N)" if ((current_time - start_time > timeout_ms)); then echo -n "$out" return 1 fi $sleep_cmd done } busywait() { local timeout_ms=$1; shift loopy_wait : "$timeout_ms" "$@" } # timeout in seconds slowwait() { local timeout_sec=$1; shift loopy_wait "sleep 0.1" "$((timeout_sec * 1000))" "$@" }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件