[ubuntu-uk] Clearing home directory at logout

Neil Greenwood neil.greenwood.lug at gmail.com
Fri Jan 30 21:22:23 GMT 2009


2009/1/30 Andrew Oakley <Andrew.Oakley at hesa.ac.uk>:
>[snip]
> Public domain, do as you like.
>

Slight bash optimisation included below...

> [snip]
>
> username=$1
>
> if [[ "$username" == "" ]]
>
> then
>
>  username=$defaultusername
>
> fi
>

username=${1:-${defaultusername}}


This single line replaces both the assignment and the 'if..fi' block.
The unfortunate bit about this replacement is that no one understands
it without reading the bash man page! :-)


Cofion/Regards,
Neil.



More information about the ubuntu-uk mailing list