this is super trivial and i did find a lot of answers close, but still can't work this out. i made a script with an argument, basically something like:
var1=$1
echo "outside the pipe, my variable is set: $var1"
ls *.* | xargs sh -c 'echo "$0" "$@"; echo "inside the pipe, my variable is empty: $var1"'
my problem is, that i need to pipe a list of file names and also my one variable. how would i do this? i tried to write my file list into an array, then append/prepend my argument and pass this into the pipe but this does create problems later since i process this in chunks, my original script is something like (imagemagick):
ls *.png | xargs -n 100 sh -c 'convert "$0" "$@" -evaluate-sequence $var1 ../out2/"$0"'
any help is appreciated a lot!