If you want to put a variable into a string you have to put a @-sign before the leading "-sign.
On Mon, Mar 31, 2014 at 4:04 AM, Estu Fardani <[email protected]> wrote: > hi, > i just want to run command like bashscript. so i can put dinamyc variable. > this my sample bash script > > #!/bin/bash > STR=brasero > apt-get install $STR -y > > and this my vala code > > public static JSCore.Value installapp (Context ctx, > JSCore.Object function, > JSCore.Object thisObject, > JSCore.Value[] arguments, > out JSCore.Value exception) { > exception = null; > > var nama = "brasero"; > > //run program with root previlage or run gksudo, its show a box root > try { > Process.spawn_command_line_async ("sudo apt-get install $nama -y"); > } catch (SpawnError e) { > stdout.printf ("Error: %s\n", e.message); > } > return new JSCore.Value.undefined (ctx); > } > > but when i run the program, i got this message : > *Reading package lists... Done* > *Building dependency tree * > *Reading state information... Done* > *E: Unable to locate package $nama* > *E: Couldn't find any package by regex '$nama'* > > did I missing something? > > this my github : > https://github.com/tuanpembual/Testing/blob/master/app.vala#L62 > > thanks a lot of. > > - Estu Fardani - > +62 856 432 14898 > Linux Blog: http://tuanpembual.wordpess.com< > http://tuanpembual.wordpress.com> > _______________________________________________ > vala-list mailing list > [email protected] > https://mail.gnome.org/mailman/listinfo/vala-list > _______________________________________________ vala-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/vala-list
