I am doing this script that does quite a bit of things to user accounts, but I am curious if I could make this portion into a variable:
Say I have several users; tom, burt, ernie, etc and I want to make sure that their accounts are set to never expire, etc. Currently, I am doing:
Code:
chage -I -1 -m 0 -m -99999 -E -1 tom
<other code for the above user>
chage -I -1 -m 0 -m -99999 -E -1 burt
<other code for the above user>
chage -I -1 -m 0 -m -99999 -E -1 ernie
<other code for the above user>
Just looking for a way to put the initial command string into a variable, then call out the user name...such as
Code:
CHAGE=`chage -I -1 -m 0 -m -99999 -E -1`
<other code>
$CHAGE tom
<other code>
$CHAGE burt
<other code>
$CHAGE ernie
<other code>
as it sits above, I get usage errors, then help options for chage, then "command not found" errors for tom, etc.
I wasn't really interested in creating a list or polling from a list and having the command loop through anything, just a way to bind the CHAGE variable to whatever username I would give it.
thanks!