lint(sh): removed redundant [ around if blocks (fix #500, SC2143)

This commit is contained in:
Shyam Mahajan
2022-08-21 14:25:40 +05:30
committed by AJ ONeal
parent 22310ec528
commit 9c38a0124c
4 changed files with 6 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ pkg_install() {
(
cd "$WEBI_TMP" 2>&1 > /dev/null
if [ -n "$(command -v rsync 2> /dev/null | grep rsync)" ]; then
if command -v rsync 2> /dev/null | grep -q rsync; then
rsync -Krl ./xmpl*/ "$pkg_src/" 2> /dev/null
else
cp -Hr ./xmpl*/* "$pkg_src/" 2> /dev/null

View File

@@ -7,7 +7,7 @@ _install_brew() {
# Straight from https://brew.sh
#/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
if [ -n "$(uname -a | grep -i darwin)" ]; then
if uname -a | grep -q -i darwin; then
needs_xcode="$(/usr/bin/xcode-select -p > /dev/null 2> /dev/null || echo "true")"
if [ -n "${needs_xcode}" ]; then
echo ""

View File

@@ -5,7 +5,7 @@ set -u
__init_git() {
if [ -z "$(command -v git)" ]; then
if [ -n "$(uname -a | grep -i darwin)" ]; then
if uname -a | grep -q -i darwin; then
echo >&2 "Error: 'git' not found. You may have to re-install 'git' on Mac after every major update."
echo >&2 " for example, try: xcode-select --install"
# sudo xcodebuild -license accept

View File

@@ -6,7 +6,7 @@ __init_pyenv() {
curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
if [ ! -f ~/.bashrc ] || [ -z "$(grep 'pyenv init' ~/.bashrc)" ]; then
if [ ! -f ~/.bashrc ] || ! grep -q 'pyenv init' ~/.bashrc; then
echo '' >> ~/.bashrc
echo '# added by Webi for pyenv' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
@@ -15,7 +15,7 @@ __init_pyenv() {
if [ -n "$(command -v zsh)" ]; then
touch ~/.zshrc
if [ -z "$(grep 'pyenv init' ~/.zshrc)" ]; then
if ! grep -q 'pyenv init' ~/.zshrc; then
echo '' >> ~/.zshrc
echo '# added by Webi for pyenv' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
@@ -26,7 +26,7 @@ __init_pyenv() {
if [ -n "$(command -v fish)" ]; then
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish
if [ -z "$(grep 'pyenv init' ~/.config/fish/config.fish)" ]; then
if ! grep -q 'pyenv init' ~/.config/fish/config.fish; then
echo '' >> ~/.config/fish/config.fish
echo '# added by Webi for pyenv' >> ~/.config/fish/config.fish
echo 'status is-login; and pyenv init --path | source' >> ~/.config/fish/config.fish