Assuming one has the following directory:
mkdir """ '''\n "
And one queries the directory with:
stat --printf '%n' ** #or for simplicity stat --printf '%n' $'\n'\'\'\'\\n$'\n'
And captures the returned filename from stdout in a variable getting the correct binary representation of the filename:
#this should be a new line which I can't show '''\n
How can one send that variable to execute subsequent commands on stdin and have them ALWAYS work e.g. sending it as a string fails:
This works for most cases but not all:
The command below also works for most cases but not all:
p="$(cat<<EOF '''\n EOF )" stat -- "$p"
If I use the captured variable as an arguement via node's spawn it works - so the capture from stat is correct and the problem is the translation that occurs when sending the variable as a string to stdin - which is required