December 2018
Beginner
452 pages
12h 17m
English
The first candidate for inclusion in our own private function library is correctly setting the current working directory. This is a pretty simple function, so we'll add it without too much explanation:
reader@ubuntu:~/scripts/chapter_13$ vim ~/bash-function-library.sh reader@ubuntu:~/scripts/chapter_13$ cat ~/bash-function-library.sh #!/bin/bash###################################### Author: Sebastiaan Tammer# Version: v1.1.0# Date: 2018-11-17# Description: Bash function library.# Usage: source ~/bash-function-library.sh#####################################<SNIPPED># Set the current working directory to the script location.set_cwd() { cd $(dirname $0)}
Because a function library is something that is potentially updated ...