Ok I need some help on this one, as I am about to beat a whole in my head from staring at my screen.
Basically I am trying to take a list of usernames in a text file and run the 'groups' command against each one in the file. Normally my script would look like this:
# for users in $(cat users.txt); do groups $users; done > groups.txt
but for some STUPID reason the sun box I am running this on does not like the "$(cat users.txt)" entry
So I have tried it every way i can think of:
# for users in 'cat users.txt'; do groups $users; done > groups.txt
# for users in (cat users.txt); do groups $users; done > groups.txt
# for users in "cat users.txt"; do groups $users; done > groups.txt
# for users in cat users.txt; do groups $users; done > groups.txt
I typically get the message below:
groups: cat : No such user
groups: users.txt : No such user
Can someone help with this before I smash this box...
Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Why Shell Scripting?
Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…