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

Feature: Should warn about unquoted exports in /bin/sh #951

Open
2 tasks done
koalaman opened this issue Jul 12, 2017 · 2 comments
Open
2 tasks done

Feature: Should warn about unquoted exports in /bin/sh #951

koalaman opened this issue Jul 12, 2017 · 2 comments

Comments

@koalaman
Copy link
Owner

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

#!/bin/sh
var="foo bar"
export foo=$var

Here's what shellcheck currently says:

Nothing

Here's what I wanted or expected to see:

The value for export must be quoted in POSIX sh

@mklement0
Copy link

Excellent idea; if the author of /etc/profile.d/apps-bin-path.sh that ships with Ubuntu 18.04 had been warned about this, PowerShell/PowerShell#12020 wouldn't have happened.

@emorrp1
Copy link

emorrp1 commented Oct 20, 2020

This is also relevant to SC2046 for command substitution assignments, and interacts with SC2155, here's a few additional examples:

#!/bin/sh
var=$(cat) # does *not* need quoting
export var=$(cat) # SC2155
if var=$(cat); then
  true
fi

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

No branches or pull requests

3 participants