Skip to main content
Question

$3 returning blank in scripts

  • November 2, 2011
  • 4 replies
  • 11 views

Forum|alt.badge.img+6

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

Forum|alt.badge.img+4
  • Contributor
  • November 2, 2011

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


Forum|alt.badge.img+31
  • Honored Contributor
  • November 2, 2011

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


Forum|alt.badge.img+12
  • Contributor
  • November 2, 2011

John,

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

See the note section.

Sean


Forum|alt.badge.img+6
  • Author
  • Contributor
  • November 2, 2011

Thanks. Learn something new everyday.