Team, I cannot see variable substitution while performing xargs command. any hint, how to replace $hostname? on my system hostname is a command and not a variable defined in env. But i can set it to variable also..
hostname="$(hostname)"
ls -ltr /var/log/console.* | awk -F 'log/' '{print $2}' | xargs -
l1 -- sh -c 'aws s3 cp /var/log/"$1" s3://test-
bucket/dom0/$hostname/' --
output
upload: ../var/log/console.68.log to s3://test-
bucket/dom0//console.68.log
Please observe dom0// above it should be
expected
dom0/host-123/console.68.log