summaryrefslogtreecommitdiff
path: root/shell.go
diff options
context:
space:
mode:
Diffstat (limited to 'shell.go')
-rw-r--r--shell.go18
1 files changed, 16 insertions, 2 deletions
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))