依次向/etc/passwd中的每个用户问好,并显示对方的shell
#!/bin /bash # for I in `cut -d ":" -f1 /etc/passwd`;do B=`grep "^$I\>" /etc/passwd | cut -d ":" -f7` echo "hello, $I your bash is $B " done
执行结果
[[email protected] ~]# bash ./helloeveryone.sh hello, root your bash is /bin/bash hello, bin your bash is /sbin/nologin hello, daemon your bash is /sbin/nologin hello, adm your bash is /sbin/nologin hello, lp your bash is /sbin/nologin hello, sync your bash is /bin/sync hello, shutdown your bash is /sbin/shutdown hello, halt your bash is /sbin/halt hello, mail your bash is /sbin/nologin hello, uucp your bash is /sbin/nologin hello, operator your bash is /sbin/nologin hello, games your bash is /sbin/nologin hello, gopher your bash is /sbin/nologin hello, ftp your bash is /sbin/nologin hello, nobody your bash is /sbin/nologin hello, dbus your bash is /sbin/nologin hello, usbmuxd your bash is /sbin/nologin hello, vcsa your bash is /sbin/nologin hello, rtkit your bash is /sbin/nologin hello, avahi-autoipd your bash is /sbin/nologin hello, pulse your bash is /sbin/nologin hello, haldaemon your bash is /sbin/nologin hello, ntp your bash is /sbin/nologin hello, apache your bash is /sbin/nologin hello, saslauth your bash is /sbin/nologin hello, postfix your bash is /sbin/nologin hello, abrt your bash is /sbin/nologin hello, gdm your bash is /sbin/nologin hello, sshd your bash is /sbin/nologin hello, tcpdump your bash is /sbin/nologin hello, my123 your bash is /bin/bash hello, qms your bash is /bin/bash hello, myhorace your bash is /sbin/nologin hello, user your bash is /bin/bash hello, hadoop your bash is /bin/bash hello, mandriva your bash is /bin/bash hello, fedora your bash is /bin/tcsh hello, hive your bash is /bin/tcsh hello, user11 your bash is /bin/bash hello, user12 your bash is /bin/bash hello, user13 your bash is /bin/bash
时间: 2024-11-02 23:22:31