From 70a13406f0a37f49daf7b0b327d9d7c5850a6836 Mon Sep 17 00:00:00 2001 From: Ryan Delaney <1139517+rpdelaney@users.noreply.github.com> Date: Wed, 22 May 2019 11:22:09 -0700 Subject: [PATCH] Fix a couple small shellcheck errors (#915) * Fix shellcheck SC2046 Further reading: https://github.com/koalaman/shellcheck/wiki/Sc2046 * Fix shellcheck 2068 Further reading: https://github.com/koalaman/shellcheck/wiki/Sc2068 * Fix syntax error from bad quoting I also used a docstring here because the escaping makes it harder for humans to parse --- thefuck/shells/bash.py | 6 +++--- thefuck/shells/generic.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/thefuck/shells/bash.py b/thefuck/shells/bash.py index d8a53180..df972380 100644 --- a/thefuck/shells/bash.py +++ b/thefuck/shells/bash.py @@ -20,8 +20,8 @@ class Bash(Generic): export TF_HISTORY=$(fc -ln -10); export PYTHONIOENCODING=utf-8; TF_CMD=$( - thefuck {argument_placeholder} $@ - ) && eval $TF_CMD; + thefuck {argument_placeholder} "$@" + ) && eval "$TF_CMD"; unset TF_HISTORY; export PYTHONIOENCODING=$TF_PYTHONIOENCODING; {alter_history} @@ -79,7 +79,7 @@ class Bash(Generic): config = 'bash config' return self._create_shell_configuration( - content=u'eval $(thefuck --alias)', + content=u'eval "$(thefuck --alias)"', path=config, reload=u'source {}'.format(config)) diff --git a/thefuck/shells/generic.py b/thefuck/shells/generic.py index ddd868ae..d7a936cb 100644 --- a/thefuck/shells/generic.py +++ b/thefuck/shells/generic.py @@ -34,8 +34,8 @@ class Generic(object): return command_script def app_alias(self, alias_name): - return "alias {0}='eval $(TF_ALIAS={0} PYTHONIOENCODING=utf-8 " \ - "thefuck $(fc -ln -1))'".format(alias_name) + return """alias {0}='eval "$(TF_ALIAS={0} PYTHONIOENCODING=utf-8 """ \ + """thefuck "$(fc -ln -1)")"'""".format(alias_name) def instant_mode_alias(self, alias_name): warn("Instant mode not supported by your shell")