小编Eli*_*ani的帖子

用户从 CSV 文件创建脚本

我试图让这个脚本工作,但我得到的是:

14:语法错误:“(”意外(期望“fi”)。

希望你们能解决我的问题,因为我调查错误已经有一段时间了...如果您需要该.csv文件,请告诉我。

这是脚本:

#!/bin/bash
filein="proyecto3.csv"
IFS=$'\n'
if [ ! -f "$filein" ]
then
echo "Cannot find file $filein"
else
  groups=(`cut -d: -f 6 "$filein" | sed 's/ //'`)
  fullnames=(`cut -d: -f 1 "$filein"`)
  userid=(`cut -d: -f 2 "$filein"`)
  usernames=(`cut -d: -f 1 "$filein" | tr [A-Z] [a-z] | awk '{print substr($1,1,1) $2}'`)
fi
for group in ${groups[*]}
do
grep -q "^$group" /etc/group ; let x=$?
if [ $x -eq 1 ]
then
groupadd "$group"
fi
done
  x=0 …
Run Code Online (Sandbox Code Playgroud)

bash scripts

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

标签 统计

bash ×1

scripts ×1