Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formmater replace `` into $() #36

Closed
Edger opened this issue May 1, 2019 · 3 comments
Closed

Formmater replace `` into $() #36

Edger opened this issue May 1, 2019 · 3 comments
Labels
upstream the upstream problem

Comments

@Edger
Copy link

Edger commented May 1, 2019

I want to assign the dns result to dns_server by networksetup -getdnsservers Wi-Fi in the shellscript, but after I format it, the formatter replace `` into $(), show as below:

before format:

dns_server=`networksetup -getdnsservers Wi-Fi`

after format:

dns_server=$(networksetup -getdnsservers Wi-Fi)

@foxundermoon
Copy link
Owner

this is upstream issue,
https://github.com/mvdan/sh/issues
you can query the cause from the author.
I think $(…) is much clearer and easier to use when nesting.

@foxundermoon foxundermoon added the upstream the upstream problem label May 1, 2019
@Edger
Copy link
Author

Edger commented May 2, 2019

@foxundermoon

Well, the problem is, after the replacement, this command can not execute correctly.

@kael89
Copy link

kael89 commented Jan 17, 2021

@foxundermoon could this issue please be reopened? It seems that $() and `` are not always interchangeable., and converting one to the other may break existing code.

An example:

input="ap-southeast-2c"

echo `echo $input | sed -e 's:\([0-9]\)[a-z]*\$:\\1:'` #ap-southeast-2
echo $(echo $input | sed -e 's:\([0-9]\)[a-z]*\$:\\1:') #ap-southeast-2c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream the upstream problem
Projects
None yet
Development

No branches or pull requests

3 participants