Pass a null terminated string to bash function -
my exported function :
myfunc(){ # operation null terminated string # if use $1, guaranteed null terminated string? }
for sake of example, consider
find . -type -f -print0 | while read -rd '' line myfunc "$line" done
if you're using print0
make sure use empty ifs=
in addition -d ''
in read
make null delimiter:
while ifs= read -r -d '' line; myfunc "$line" done < <(find . -type f -print0)
as shown can avoid pipeline , use process substitution.
Comments
Post a Comment