From c877c3886d804a9eadb22657403f574684c024f5 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 10 Feb 2024 16:31:19 -0600 Subject: updates after 4 years Signed-off-by: Jeff Carr --- shell.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'shell.go') diff --git a/shell.go b/shell.go index 0ca2de3..6b4d1a2 100644 --- a/shell.go +++ b/shell.go @@ -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)) -- cgit v1.2.3