小编Ton*_*ony的帖子

Bash -eq评估为true?

有人可以帮我弄清楚为什么我的代码导致下面的输出?特别是当/ etc /传递中没有匹配的字符串时?

码:

for user in ${usernames[*]}
do
egrep ${user} /etc/passwd >/dev/null
echo -e "\nChecking if users already exist..."
if [ $? -eq 0 ]; then
echo -e "${user} exists!, skipping creation"
Run Code Online (Sandbox Code Playgroud)

OUTPUT:

+ for user in '${usernames[*]}'
+ egrep addaf /etc/passwd
+ echo -e '\nChecking if users already exist...'
Checking if users already exist...
+ '[' 0 -eq 0 ']'
+ echo -e 'addaf exists!, skipping creation'
addaf exists!, skipping creation
Run Code Online (Sandbox Code Playgroud)

bash loops

1
推荐指数
1
解决办法
61
查看次数

Powershell .value 与 .values

我有一个返回 DictionaryEntry 集合的脚本,我注意到如果该字典恰好只有一个 K/V 对,我必须指定 var.value 与如果它有多个 var.values !是什么赋予了?有没有通用的方法来解决这个问题?在一个命令中?

powershell dictionary

1
推荐指数
1
解决办法
740
查看次数

Excel CountIf部分匹配

我在Excel A和B中有两列 - B列中的值包含在A列中较大的字符串中.

即A列:abcedsdes4568sdfs B列:es456

如何使用countIF显示/检测任何匹配?

excel

-1
推荐指数
1
解决办法
2万
查看次数

如何将包含引号的命令的输出作为awk变量传递?

期待用awk设置日期变量,但无法获得引用或语法正确!

awk -v c=$i -v d="date +\"%D %r %Z\"" '{print d c }'
Run Code Online (Sandbox Code Playgroud)

bash shell awk

-2
推荐指数
1
解决办法
56
查看次数

标签 统计

bash ×2

awk ×1

dictionary ×1

excel ×1

loops ×1

powershell ×1

shell ×1