diff options
| author | Jeff Carr <[email protected]> | 2024-02-10 16:31:19 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-10 16:31:19 -0600 |
| commit | c877c3886d804a9eadb22657403f574684c024f5 (patch) | |
| tree | 907e4ff83123eae78fc3757299c90b96645e0760 /shell.go | |
| parent | 0b634a2a53c1b88f1dcb0f5593d7f59542055cb0 (diff) | |
updates after 4 years
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'shell.go')
| -rw-r--r-- | shell.go | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -56,7 +56,7 @@ func Script(cmds string) int { line = Chomp(line) // this is like 'chomp' in perl log.Log(INFO, "LINE:", line) time.Sleep(1) - Run(line) + RunString(line) } return 0 } @@ -102,7 +102,7 @@ func RM(filename string) { func Daemon(cmdline string, timeout time.Duration) int { for { - Run(cmdline) + RunString(cmdline) time.Sleep(timeout) } } @@ -174,6 +174,20 @@ func Exists(filename string) bool { return true } +// makes the directory +func Mkdir(dir string) bool { + if Dir(dir) { + // already a dir + return true + } + if Exists(dir) { + // something else is there + return false + } + Run([]string{"mkdir", "-p", dir}) + return true +} + // return true if the filename exists (cross-platform) func Dir(dirname string) bool { info, err := os.Stat(Path(dirname)) |
