[Help-bash] How to not print command in $() when set -v is enabled?
From:
Peng Yu
Subject:
[Help-bash] How to not print command in $() when set -v is enabled?
Date:
Mon, 10 Feb 2014 08:57:38 -0600
Hi,
The following example shows that the 2nd echo is also printed. Since
it is in $(), a better behavior might be not to print it. Is there a
way to do so in bash? Thanks.
~/linux/test/bash/man/builtin/set/-v/$($ cat main.sh
#!/usr/bin/env bash
set -v
echo "$(echo "Hello World!")"
~/linux/test/bash/man/builtin/set/-v/$($ ./main.sh
echo "$(echo "Hello World!")"
echo "Hello World!")"
echo "Hello World!")
echo "Hello World!"
Hello World!
--
Regards,
Peng