diff options
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)) |
