On Jan 31, 2008, at 10:08, Daniel J. Luke wrote:
On Jan 31, 2008, at 10:29 AM, Juan Manuel Palacios wrote:
USHELL="$(nicl . -read /users/rschmidt shell | sed 's/^shell: //'')"
In any case, your suggestion seems straight forward and simple enough, so I'll quit trying to reinvent the wheel and will give it a shot as soon as I get a few spare minutes (there are some implementation details, like nicl for < 10.4 and dscl for Leopard, among others).
except that you want to use dscl instead of nicl (and then need to tweak the sed pattern).
Something like:
dscl . -read /users/dluke shell | sed 's/^.*shell: //'
For those without access to both 10.4 and 10.5 machines: On 10.4: nicl . -read /users/$USER shell and dscl . -read /users/$USER shell both produce output like this: shell: /bin/bash On 10.5, nicl does not exist, and dscl . -read /users/$USER shell produces output like this: dsAttrTypeNative:shell: /bin/bash So we should set THE_UTIL to "nicl" on 10.4 and earlier, or "dscl" on 10.5 and up, and then use: $THE_UTIL . -read /users/$USER shell | sed 's/^.*: //'