July 2018
Beginner
264 pages
8h 9m
English
To prepare for this example, create the following two files and open both:
Inside library.sh, add the following:
#!/bin/bashfunction create_file() { local FNAME=$1 touch "${FNAME}" ls "${FNAME}" # If output doesn't return a value - file is missing}function delete_file() { local FNAME=$1 rm "${FNAME}" ls "${FNAME}" # If output doesn't return a value - file is missing}
Inside io_maker.sh, add the following:
#!/bin/bashsource library.sh # You may need to include the path as it is relativeFNAME="my_test_file.txt"create_file "${FNAME}"delete_file "${FNAME}"exit 0
When you run the script, you should get the same output:
$ bash io_maker.shmy_test_file.txt ...
Read now
Unlock full access