列举普通帐户问题

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
自由建客
帖子: 13468
注册时间: 2008-07-30 23:21
系统: Debian stable AMD64

列举普通帐户问题

#1

帖子 自由建客 » 2015-09-03 20:44

代码: 全选

	local line user gid
	while read line
	do
		read user gid <<<"$line"
		# 一些操作
	done <<<"`awk -F: '$3>=1000 && $1 !="nobody" {print $1,$4}' /etc/passwd`"
	return 0

这段在 /bin/bash 中可行,但在 /bin/sh 中就不行了,求破!
头像
astolia
论坛版主
帖子: 6431
注册时间: 2008-09-18 13:11

Re: 列举普通帐户问题

#2

帖子 astolia » 2015-09-05 9:37

<<<是bash的语法,自己去换成POSIX标准的
头像
冲浪板
论坛版主
帖子: 7513
注册时间: 2007-05-06 8:19

Re: 列举普通帐户问题

#3

帖子 冲浪板 » 2015-09-05 12:46

这要是红帽,就是要设置一次,让系统知道这个夹子是脚本,可以运行
回复