2010/10/9 Uwe Kleine-KÃnig <u.kleine-koenig@xxxxxxxxxxxxxx>: > On Sat, Oct 09, 2010 at 11:41:47PM +0200, Bert Wesarg wrote: >> +# get_temp NAME [-d] > I like your patch in general, but would prefer to have > >    Â# get_temp [-d] NAME But that would complicate the argument evaluation, wouldn't it: get_temp() { if [ $# -eq 2 ]; then mktemp $1 "$tg_tmp_dir/$2.XXXXXX" else mktemp "$tg_tmp_dir/$1.XXXXXX" fi } This and the functions with [-i | -w] are internal and won't be called by the user, so we have full control over the calling convention and should make it easy for us. And putting the optional argument at the end is easy. I should probably remove the die call in cat_file, because that would be an programmer error not an user error. > >> +# creates a new temporary file (or directory with -d) in the global >> +# temporary directory $tg_tmp_dir with pattern prefix NAME >> +get_temp() >> +{ >> +   mktemp ${2-} "$tg_tmp_dir/$1.XXXXXX" > Does the - makes any difference? ÂIf yes, is it portable (enough)? For me its an indicator, that it doesn't matter whether $2 was given or not. Also you could run under set -u without error. But I don't do this. It's in POSIX [1]. Bert [1] Statement given without interpretation. > Best regards > Uwe > > -- > Pengutronix e.K.              | Uwe Kleine-KÃnig      Â| > Industrial Linux Solutions         | http://www.pengutronix.de/ Â| > -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html