2009/1/30 Andrew Oakley <andrew.oak...@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.

-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/

Reply via email to