Posted on 05-21-2013 08:48 AM
Hey everyone. I am running the current command at login to track LDAP and login:
sudo jamf recon -endUsername $3
How can I pass the username with all lowercases? I have tried:
#!/bin/sh
sudo jamf recon -endUsername $3 | tr '[A-Z]' '[a-z]'
This is an "at login" script.
Posted on 05-21-2013 09:41 AM
First off, how are you seeing uppercase usernames coming from $3? Are they somehow set that way from your LDAP environment? Usually usernames are lowercase.
Anyway, what you have there won't work because you're trying to pipe the entire command into tr. I doubt the shell would understand what you're looking to do, which is to convert just $3 to lowercase.
Since it looks like you're running a script and not a Run Command one-liner, try this
#!/bin/sh
userAcct=$( echo $3 | tr '[A-Z]' '[a-z]' )
sudo jamf recon -endUsername $userAcct
Posted on 05-21-2013 10:07 AM
It has something to do with our LDAP. When the username comes up you get two options in an LDAP search.
UserName or username. UserName is default but I want username because that pulls all the LDAP info.
Posted on 05-21-2013 10:23 AM
Didn't work for me :(
Posted on 05-21-2013 10:52 AM
Can you edit your LDAP mappings on your JSS to pull the correct information as its default? That would seem like a more sane approach than trying to work around the wrong information from the get-go.
If that's not possible or it will mess up a bunch of other things, can you provide an example or two of what you're seeing, maybe a username example?
Posted on 05-21-2013 04:58 PM
Try
sudo jamf recon -endUsername `echo $3 | tr '[A-Z]' '[a-z]'`