[Casper] Bash Scripts using ~

Thomas Larkin tlarki at kckps.org
Tue Apr 21 08:59:22 PDT 2009


Just note that if you use the $3 variable it only runs as the current
user if Casper runs the script.  If you run the script locally that
variable doesn't mean anything and if by some reason you need to run it
locally, you could loop through the /users and then execute your
commands. 

Now I have successfully used the ~/ in scripts before, but I had to use
it as a variable and the script was intended to be ran by the user,
which was me.  In general you don't want to use it.


___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry:  913-449-7589
office:  913-627-0351





>>> Ryan Harter <rharter at uwsp.edu> 04/21/09 10:53 AM >>>
The ~ expands as the current user's home directory.  Login hooks, and
scripts in general in Casper, are run as root.  That means that ~ would
expand to root's home. 



AFAIK it's general practice not to use the ~ in scripts because it's not
really interpreted the same everywhere.  This probably isn't an issue if
you're only using them on Mac. 



The way you would do this is to use the $3 variable, which Casper sets
to the username.  Use something like /Users/$3/ to get the user's home
directory.


Ryan Harter 

UW - Stevens Point 

Workstation Developer 

715.346.2716 


Ryan.Harter at uwsp.edu 



On Apr 21, 2009, at 10:46 AM, dhowell at austinisd.org wrote: 





I can't get any of my login hooks to work in Casper self service. I do
have other scripts that work

It seems anytime I use the ~ for logged in user it doesn't work.


Is this treated differently in Casper. I run it in terminal it works
fine. I am sure It is me doing something wrong


D. Trey Howell
trey.howell at austinisd.org
Desktop Engineering

Secret Windows code: while (1) { if (num_process > 1) {
bluescreen(rand()); } }

This email message, including all attachments, is for the sole use of
the intended recipient(s) and may contain confidential student and/or
employee information.  Unauthorized use of disclosure is prohibited
under the federal Family Education Rights & Privacy Act (20 U.S.C.
§1232g, 34 CFR Part 99, 19 TAC 247.2, Gov&#8217, t Code 552.023,
Educ. Code 21.355, 29 CFR 1630.14(b)(c)).  If you are not the intended
recipient, you may not use, disclose, copy or disseminate this
information.  Please call the sender immediately or reply by email and
destroy all copies of the original message, including attachments.

<ATT00001.txt> 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090421/d0be1fb6/attachment.htm 


More information about the Casper mailing list