Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] question about shell scripting
- Date: Thu, 25 Jan 2007 17:13:19 +0900 (JST)
- From: scott@example.com
- Subject: [tlug] question about shell scripting
- User-agent: SquirrelMail/1.4.8-2.el4.centos4
Hi everyone, I am still a newbie to bash shell scripting and have a very quick question. I would like to perform a command recursively- for example I would like to list all of the crotabs for all of the users in the system. So first I get a list of users: awk -F: '{ print $1 }' /etc/shadow which is OK. However if I want to use backticks and do something like this: crontab -l -u `awk -F: '{ print $1 }' /etc/shadow` it crashes. I'm guessing that the output of that awk is a stream instead of a list of individual names with a line break. I thought maybe I could write a for statement in a script this way: #!/bin/bash for x in `awk -F: '{ print $1 }' /etc/shadow`; /usr/bin/crontab -l -u $x; done but that crashes as well. I'm pretty sure I could do this in PERL using an array and then a foreach $line (@), but I'd like to do this in bash, just to learn more about bash scripting. Any hints how can I get each iteration of this "for" command to separately input the usernames into the crontab command, wait for stdout, then iterate again using a bash script? Study study, Scott VanDusen Tokyo
- Follow-Ups:
- Re: [tlug] question about shell scripting
- From: Josh Glover
- Re: [tlug] question about shell scripting
- From: Botond Botyanszki
- Re: [tlug] question about shell scripting
- From: Keith Bawden
- Re: [tlug] question about shell scripting
- From: Curt Sampson
- Re: [tlug] question about shell scripting
- From: Chris BALUTA
- Re: [tlug] question about shell scripting
- From: Godwin Stewart
Home | Main Index | Thread Index
- Prev by Date: [tlug] Networking two Linux computers harder than Linux to Windows?
- Next by Date: Re: [tlug] Networking two Linux computers harder than Linux to Windows?
- Previous by thread: Re: [tlug] Networking two Linux computers harder than Linux to Windows?
- Next by thread: Re: [tlug] question about shell scripting
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links