Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # exit when any command fails
- set -e
- error() {
- unset FUNCNAME[0] #remove this function name from callstack list
- echo "ERROR callstack(${FUNCNAME[@]}): $*" 1>&2
- exit 1
- }
- read_file() {
- #---check input parameters---#
- local path=$1
- #---read file to output varible---#
- local output="$(cat $path 2>&1)" status="$?"
- if [[ $status -ne 0 ]]; then
- error $output
- exit
- fi
- echo "$output"
- }
- test() {
- local io=$(read_file "/root/pve-zfs-clone/tests/test_file_1")
- }
- test
- echo 567
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement