vodkadrinker
Technical User
Is it possiable to set two variables from one awk command.
Here is an example of what I am trying to do.
Data file example: /tmp/oldpasswd
test:x:106:103::/home/test:/usr/bin/ksh
test2:x:106:103::/home/test2:/usr/bin/ksh
test3:x:106:103::/home/test3:/usr/bin/ksh
Script so far:
for i in `awk -F: '{print $1 $6 $7}' /tmp/oldpasswd`
do
useradd -d${HOMEDIR} -s$USERSH ${USER}
done
I would like to set variables from the awk line ie.
USER=$1
HOMEDIR=$6
USERSH=$7
so that I can run other checks before running the useradd command.
Any help would be appreciated, thanks VD
Here is an example of what I am trying to do.
Data file example: /tmp/oldpasswd
test:x:106:103::/home/test:/usr/bin/ksh
test2:x:106:103::/home/test2:/usr/bin/ksh
test3:x:106:103::/home/test3:/usr/bin/ksh
Script so far:
for i in `awk -F: '{print $1 $6 $7}' /tmp/oldpasswd`
do
useradd -d${HOMEDIR} -s$USERSH ${USER}
done
I would like to set variables from the awk line ie.
USER=$1
HOMEDIR=$6
USERSH=$7
so that I can run other checks before running the useradd command.
Any help would be appreciated, thanks VD