summaryrefslogtreecommitdiff
path: root/shell.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-06-13 20:26:04 -0700
committerJeff Carr <[email protected]>2019-06-13 20:26:04 -0700
commitdb4ffc0fa9ae0d032c05f3e3ac4dc0af4a48db8f (patch)
tree3743bc1abfbada2c2cdd98e2113651ee161e73f4 /shell.go
parent49d36e287d983f72b2b2b5d903fb3bf55a44b440 (diff)
more ssh tests
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'shell.go')
-rw-r--r--shell.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/shell.go b/shell.go
index ab8a695..cfa9b94 100644
--- a/shell.go
+++ b/shell.go
@@ -272,3 +272,21 @@ func Exec(cmdline string) {
log.Println("shell.Exec() err =", err)
os.Exit(0)
}
+
+// return true if the filename exists
+func Exists(filename string) bool {
+ _, err := os.Stat(filename)
+ if os.IsNotExist(err) {
+ return false
+ }
+ return true
+}
+
+// return true if the filename exists
+func Dir(dirname string) bool {
+ info, err := os.Stat(dirname)
+ if os.IsNotExist(err) {
+ return false
+ }
+ return info.IsDir()
+}