diff -urN uci_ori/cli.c uci/cli.c
--- uci_ori/cli.c	2010-08-14 16:39:58.000000000 +0800
+++ uci/cli.c	2010-08-27 10:01:35.713750000 +0800
@@ -607,7 +607,9 @@
 int main(int argc, char **argv)
 {
 	int ret;
-	int c;
+	int c, arg_count=argc;
+	char argv_ori[argc][64];
+	char buf[512];
 
 	flags = CLI_FLAG_SHOW_EXT;
 	appname = argv[0];
@@ -671,6 +673,13 @@
 				return 0;
 		}
 	}
+
+	if (!(flags & CLI_FLAG_QUIET)) {	// not in quiet mode: save the original argv
+		for (c=0; c<arg_count; c++) {
+			strncpy(argv_ori[c], argv[c], 64);
+		}
+	}
+	
 	if (optind > 1)
 		argv[optind - 1] = argv[0];
 	argv += optind - 1;
@@ -692,6 +701,16 @@
 		return 0;
 	}
 
+	if (ctx->err && !(flags & CLI_FLAG_QUIET)) {	// error and not quiet mode --> show detail argv in console
+		int i=0;
+		i+=sprintf(buf+i, "echo '[uci dbg] ");
+		for (c=0; c<arg_count; c++) {
+			i+=sprintf(buf+i, "%s ", argv_ori[c]);
+		}
+		sprintf(buf+i, "-- error code: %d' > /dev/console", ctx->err);
+		system(buf);
+	}
+	
 	uci_free_context(ctx);
 
 	return ret;
