ldapfinger: set safer shell options
authorAlex Dehnert <adehnert@mit.edu>
Fri, 9 Aug 2013 14:08:41 +0000 (10:08 -0400)
committerAlex Dehnert <adehnert@mit.edu>
Fri, 9 Aug 2013 14:08:41 +0000 (10:08 -0400)
ldapfinger

index 62a84f49a15608d456a51080f07fb91b470cffbb..548769ae6f0de746fef36f9f11d64e3220b921fd 100755 (executable)
@@ -1,10 +1,11 @@
-#!/bin/bash
+#!/bin/sh
 
 
+set -euf
 
 for user in "$@"; do
     echo ldapsearch -x -h ldap.mit.edu -b dc=mit,dc=edu "uid=$user"
     ldapsearch -x -h ldap.mit.edu -b dc=mit,dc=edu "uid=$user"
 done
 
 
 for user in "$@"; do
     echo ldapsearch -x -h ldap.mit.edu -b dc=mit,dc=edu "uid=$user"
     ldapsearch -x -h ldap.mit.edu -b dc=mit,dc=edu "uid=$user"
 done
 
-echo Try also athrun consult ldaps
-echo or ldapsearch -x -h ldap-too.mit.edu -b ou=moira,dc=mit,dc=edu "uid=$user"
+echo Try also athrun consult ldaps or
+echo ldapsearch -x -h ldap-too.mit.edu -b ou=moira,dc=mit,dc=edu "uid=${user:-username}"