0

Trying to execute a command like

$ sdiff -i -W -B -l  -w 140 <(curl -s "https://domain.tld/query.php?d=$(date +%Y%m%d)") <(curl -s "https://domain.tld/query.php?d=$(date --date="yesterday" +%Y%m%d)") 

I am trying to have the date automatically determined based on the datecommand .. the challenge here is that the command is inside of quotes inside of another command.

Any input is greatly appreciated. Thanks.

  • 2
    I don't immediately see why your command shouldn't work. What happens when you run it? – AFH Feb 7 at 18:29
1

On my Gentoo machine, running sdiff (GNU diffutils) 3.7, sdiff interprets 140 (from -w 140) as a separate argument. The correct invocation is this:

sdiff -i -W -B -l -w140 <(curl -s "https://domain.tld/query.php?d=$(date +%Y%m%d)") <(curl -s "https://domain.tld/query.php?d=$(date --date="yesterday" +%Y%m%d)")

Note that the options can be reduced a bit further:

sdiff -iWBlw140 <(curl -s "https://domain.tld/query.php?d=$(date +%Y%m%d)") <(curl -s "https://domain.tld/query.php?d=$(date --date="yesterday" +%Y%m%d)")

BTW: Try putting code between backticks (`) or triple-backticks next time.

  • Bingo! adding two `` did it! thank you! appreciated! – Matt Feb 7 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.