xargs / sed help? 

assume a textfile:

echo "import h from 'w.js?CACHEBUST';" > tmp/test.txt

this command:

sed -i 's/CACHEBUST/v=$(date +%s)/g' tmp/test.txt

results in my desired output:

import h from 'w.js?v=12345';

when trying to pipe that with find and xargs with:

find tmp -type f -print0 | xargs -0 sed -i 's/CACHEBUST/v=$(date +%s)/g'

I get undesired output:
import h from 'w.js?v=$(date +%s)';

My question: how do I force that expression to evaluate?

Follow

xargs / sed help? 

@tychi doublecheck your quotes. I don't think you could have used single quotes in the first instance using a standard Bourne-type shell

xargs / sed help? 

@2ck ah, that's exactly it, thanks!

been a long time since I've banged my head against quotes :)

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.