我想在Bash中編寫dirname函數,以便它不使用任何外部命令。 function dirname() {
local path=$1
[[ $path =~ ^[^/]+$ ]] && dir=. || { # if path has no slashes, set dir to .
[[ $path =~ ^/+$ ]] && dir=/ || {
我有這個到目前爲止,但我錯過了幾個像獲取cron作業腳本的東西。不想以root身份執行此操作。所以我假設可以做更多的事情來同時設置第一個用戶。該腳本需要是冪等的(如果以前使用相同的參數運行,可以反覆運行而不會冒險改變任何內容)。 singledomaincertnginx.sh: #!/bin/bash
if [ -z "$3" ]; then
echo use is "single