$3 returning blank in scripts

McAdams
New Contributor III

I was having trouble getting a script to run dseditgroup using JSS 8.3.1.

dseditgroup -o checkmember -n /Default/Local -m $3 lpadmin

I kept getting errors about no group name being specified. I put

logger "the user is: $3"

which returned the user as being blank. Shouldn't the third parameter be
the currently logged in user? I worked around it by using a line found in
the archive

username=/usr/bin/w | grep console | awk '{print $1}'

Thanks,
-- jmca

4 REPLIES 4

bkvines
New Contributor III

John,

My experience with $3 is that it only works on scripts executed at login. If the user is already logged in, that variable isn't passed.

--
Bryan Vines
bkvines at wgclawfirm.com

tlarkin
Honored Contributor

This is correct, $3 only passes as the current user when the script is ran at log in.

sean
Valued Contributor

John,

http://jamfsoftware.com/kb/article.php?id=040

See the note section.

Sean

McAdams
New Contributor III

Thanks. Learn something new everyday.