try() { "$@" || die "cannot $*"; }
appendArgTar(){
# Desc: Writes first argument to temporary file with arguments as options, then appends file to tar
- # Usage: writeArg "$(echo "Data to be written.")" [name of file to be inserted] [tar path] [temp dir] ([cmd1] [cmd2] [cmd3] [cmd4]...)
- # Version: 1.0.0
+ # Usage: appendArgTar "$(echo "Data to be written.")" [name of file to be inserted] [tar path] [temp dir] ([cmd1] [cmd2] [cmd3] [cmd4]...)
+ # Version: 1.0.2
# Input: arg1: data to be written
# arg2: file name of file to be inserted into tar
# arg3: tar archive path (must exist first)
} # Append Bash var to file appended to Tar archive
#==BEGIN sample code==
-myFile="/tmp/$(date +%s)..original"
-echo "how are you doing?" > "$myFile"
-myVAR="$(cat "$myFile")"
-writeArg "$myVAR" "$myFile..LOUD_CHILD" "tee /tmp/cloneityclone " "tr '[:lower:]' '[:upper:]'"
+myTar="/tmp/$(date +%s).tar";
+try tar --create --file="$myTar" --files-from=/dev/null ;
+myVar="how are you doing?"
+appendArgTar "$myVar" "$(date +%s)..LOUD_insidetar" "$myTar" "/dev/shm" "tee /tmp/$(date +%s)..outsidetar " "tr '[:lower:]' '[:upper:]'"
#==END sample code==
# Author: Steven Baltakatei Sandoval