def sh_command_with(f, *args):
 args = list(args)
 out = []
 for n in range(len(args)):
  args[n] = sh_string(args[n])
 if hasattr(f, '__call__'):
  out.append(f(*args))
 else:
  out.append((f % tuple(args)))
 return ';'.join(out)

def sh_command_with ( f , * args ) : args = list ( args ) out = [ ] for n in range ( len ( args ) ) : args [ n ] = sh_string ( args [ n ] ) if hasattr ( f , '__call__' ) : out . append ( f ( * args ) ) else : out . append ( ( f % tuple ( args ) ) ) return ';' . join ( out )
sh_command_with -> command returns a command create by evaluating f whenever f is a function and f % otherwise .