diff options
author | Simon Rettberg | 2018-10-16 11:46:27 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-10-16 11:46:27 +0200 |
commit | 7caa17151cbcd4647457614455ab213474523de9 (patch) | |
tree | 0cce8c92e2a17730c89331d58a3301e8e2b235e4 /core/includes | |
parent | [downloader.inc] Add autoclone helper for cloning git repos (diff) | |
download | mltk-7caa17151cbcd4647457614455ab213474523de9.tar.gz mltk-7caa17151cbcd4647457614455ab213474523de9.tar.xz mltk-7caa17151cbcd4647457614455ab213474523de9.zip |
[fileutil.inc] Add cde, cd with error handling
Diffstat (limited to 'core/includes')
-rw-r--r-- | core/includes/helper/fileutil.inc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/includes/helper/fileutil.inc b/core/includes/helper/fileutil.inc index e3d23652..89d58f1a 100644 --- a/core/includes/helper/fileutil.inc +++ b/core/includes/helper/fileutil.inc @@ -38,3 +38,8 @@ canonicalize() { cd -P -- "$(dirname -- "$1")" && printf '%s\n' "$(pwd -P)/$(basename -- "$1")" } +# "cd error": cd to given directory, perror on failure +cde () { + cd "$1" || perror "Could not cd to $1" +} + |