Reputation: 23
I have the following code in my Dockerfile. Then I piped the output to my setup.py. I need to run this command in linux terminal. How can i put comment on each line?
printf "%s\n" \
# Facebook OAuth Client ID (default)
"1234" \
# Facebook OAuth Secret (default)
"abcd" \
# Google OAuth Client ID (default)
"5678" \
# Google OAuth Secret (default)
"qwer" \
Upvotes: 2
Views: 111
Reputation: 1800
Using arrays in order to avoid long escaped by \
lists of arguments is a good practice.
You can leave a comment for each element.
CREDENTIALS=(
# Facebook OAuth Client ID (default)
"1234"
# Facebook OAuth Secret (default)
"abcd"
# Google OAuth Client ID (default)
"5678"
# Google OAuth Secret (default)
"qwer"
)
printf "%s\n" "${CREDENTIALS[@]}"
Upvotes: 1
Reputation: 780984
printf "%s\n" \
$(: 'Facebook OAuth Client ID (default)') \
"1234" \
$(: 'Facebook OAuth Secret (default)') \
"abcd" \
$(: 'Google OAuth Client ID (default)') \
"5678" \
$(: 'Google OAuth Secret (default)') \
"qwer"
$(command)
is command substitution, it gets replaced with the output of the command.
:
is a command that does nothing and produces no output. The argument needs to be quoted because of the (default)
, which would otherwise be executed as a command in a subshell.
Upvotes: 0