bash: xargs passing variable

view story

http://stackoverflow.com – How can a global script variable be passed to the command of xargs? I tried it this way: TEST=hallo2 echo "hallo" | xargs sh -c 'echo passed=$1 test=$TEST' sh Output: passed=hallo test= I know I could use the {} token but I need to do it this way! I'm using bash. (HowTos)