有人可以帮我弄清楚为什么我的代码导致下面的输出?特别是当/ 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) 我有一个返回 DictionaryEntry 集合的脚本,我注意到如果该字典恰好只有一个 K/V 对,我必须指定 var.value 与如果它有多个 var.values !是什么赋予了?有没有通用的方法来解决这个问题?在一个命令中?
我在Excel A和B中有两列 - B列中的值包含在A列中较大的字符串中.
即A列:abcedsdes4568sdfs B列:es456
如何使用countIF显示/检测任何匹配?
期待用awk设置日期变量,但无法获得引用或语法正确!
awk -v c=$i -v d="date +\"%D %r %Z\"" '{print d c }'
Run Code Online (Sandbox Code Playgroud)