gpt4 book ai didi

Bash 脚本 - 将目录名称与字符串进行比较

转载 作者:行者123 更新时间:2023-12-02 01:13:46 24 4
gpt4 key购买 nike

我正在使用此脚本在“sites”目录的每个子目录中运行一个命令,不包括“all”子目录。但是,当我运行它时,“all”子目录仍在使用,即使我使用 if 语句将其排除。

for dir in ~/htdocs/drupal/drupal/sites/*
do
if [ $dir = "/local/users/drupadm/htdocs/drupal/drupal/all" ]
then
continue
fi
echo $dir
(cd $dir && /opt/webstack/php/5.2/bin/php /local/users/drupadm/drush/drush.php $1)
done

布莱恩

最佳答案

您遗漏了 sites 子目录:

if [ "$dir" = /local/users/drupadm/htdocs/drupal/drupal/sites/all ]

关于Bash 脚本 - 将目录名称与字符串进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14249210/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com