Well actually sh means *The bourne shell.*Since the bourne shell is replaced by bash nowdays ubuntu(I am not sure but the debian OS too)have replaced sh as a command line interpreter(*i.e it is not bourne shell)*.
On Thu, Sep 15, 2011 at 11:29 AM, Amol Sharma <amolsharm...@gmail.com>wrote: > @saurabh......problem again > > now i tried the same program on redhat and it is now giving the expected > output(tried both the shells bash and sh)...........i have attached the > screenshot of my activity > i think it is depending on os specification....that is...which shell > version it is using......what do u think ?? > > > > > > > > > -- > > > Amol Sharma > Third Year Student > Computer Science and Engineering > MNNIT Allahabad > <http://gplus.to/amolsharma99> > <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> > > > > > > On Thu, Sep 15, 2011 at 9:45 AM, rahul vatsa <vatsa.ra...@gmail.com>wrote: > >> @utkarsh, its opensuse. >> >> @saurabh, i agree wht u r saying i hd also checkd that in man page. nd hd >> tried @terminal with sh, and it hadn't expanded. bt wen i run this prog on >> my m/c, it gives the expanded output. >> >> >> linux-7ap5:/home/user/test # ls >> system.c >> linux-7ap5:/home/user/test # cat system.c >> #include <stdio.h> >> >> main() >> { >> system("echo {a,b,c}{a,b,c}{a,b,c} "); >> } >> linux-7ap5:/home/user/test # make system >> cc system.c -o system >> linux-7ap5:/home/user/test # ./system >> aaa aab aac aba abb abc aca acb acc baa bab bac bba bbb bbc bca bcb bcc >> caa cab cac cba cbb cbc cca ccb ccc >> linux-7ap5:/home/user/test # >> >> >> >> On Wed, Sep 14, 2011 at 10:54 PM, saurabh singh <saurab...@gmail.com>wrote: >> >>> If you go a bit deeper into the system calls that system makes you will >>> realize that the argument is actually expanded as "sh -c echo >>> {abc}{abc}{abc} >>> The expansion facility is provided by bash but not sh.(You may verify my >>> claim) >>> The default shell is bash.*switch to sh mode and you will realize whats >>> happening.* >>> >>> >>> On Thu, Sep 15, 2011 at 2:43 AM, UTKARSH SRIVASTAV < >>> usrivastav...@gmail.com> wrote: >>> >>>> @rahul have you tried it n your system and if yes then which os? >>>> >>>> >>>> On Thu, Sep 15, 2011 at 2:28 AM, UTKARSH SRIVASTAV < >>>> usrivastav...@gmail.com> wrote: >>>> >>>>> yes it's giving wrong output on terminal using gcc compiler in ubuntu >>>>> >>>>> >>>>> On Thu, Sep 15, 2011 at 1:25 AM, Amol Sharma >>>>> <amolsharm...@gmail.com>wrote: >>>>> >>>>>> though it is giving the expected output on the ideone but i am not >>>>>> getting the the output on the terminal using gcc compiler it is just >>>>>> printing {a,b,c}{a,b,c}{a,b,c} ............what could be the reason ? >>>>>> >>>>>> my OS- Ubuntu 10.04 >>>>>> @rahul what's ur os ? >>>>>> >>>>>> -- >>>>>> >>>>>> >>>>>> Amol Sharma >>>>>> Third Year Student >>>>>> Computer Science and Engineering >>>>>> MNNIT Allahabad >>>>>> <http://gplus.to/amolsharma99> >>>>>> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Thu, Sep 15, 2011 at 1:20 AM, Amol Sharma >>>>>> <amolsharm...@gmail.com>wrote: >>>>>> >>>>>>> http://ideone.com/WQxfK >>>>>>> -- >>>>>>> >>>>>>> >>>>>>> Amol Sharma >>>>>>> Third Year Student >>>>>>> Computer Science and Engineering >>>>>>> MNNIT Allahabad >>>>>>> <http://gplus.to/amolsharma99> >>>>>>> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Thu, Sep 15, 2011 at 1:13 AM, rahul vatsa >>>>>>> <vatsa.ra...@gmail.com>wrote: >>>>>>> >>>>>>>> i tried ur code & it gives the same output as wen u execute the >>>>>>>> command on terminal. >>>>>>>> >>>>>>>> >>>>>>>> On Wed, Sep 14, 2011 at 3:03 PM, UTKARSH SRIVASTAV < >>>>>>>> usrivastav...@gmail.com> wrote: >>>>>>>> >>>>>>>>> >>>>>>>>> if i write on terminal echo {a,b,c}{a,b,c}{a,b,c} then i get the >>>>>>>>> output all possible combination of a,b,c and if i write like this >>>>>>>>> >>>>>>>>> main() >>>>>>>>> { >>>>>>>>> system("echo {a,b,c}{a,b,c}{a,b,c} "); >>>>>>>>> } >>>>>>>>> output : {a,b,c}{a,b,c}{a,b,c} >>>>>>>>> why? >>>>>>>>> in system command whatever we write is taken like a command >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> *UTKARSH SRIVASTAV >>>>>>>>> CSE-3 >>>>>>>>> B-Tech 3rd Year >>>>>>>>> @MNNIT ALLAHABAD* >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "Algorithm Geeks" group. >>>>>>>>> To post to this group, send email to algogeeks@googlegroups.com. >>>>>>>>> To unsubscribe from this group, send email to >>>>>>>>> algogeeks+unsubscr...@googlegroups.com. >>>>>>>>> For more options, visit this group at >>>>>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "Algorithm Geeks" group. >>>>>>>> To post to this group, send email to algogeeks@googlegroups.com. >>>>>>>> To unsubscribe from this group, send email to >>>>>>>> algogeeks+unsubscr...@googlegroups.com. >>>>>>>> For more options, visit this group at >>>>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>>>> >>>>>>> >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Algorithm Geeks" group. >>>>>> To post to this group, send email to algogeeks@googlegroups.com. >>>>>> To unsubscribe from this group, send email to >>>>>> algogeeks+unsubscr...@googlegroups.com. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> *UTKARSH SRIVASTAV >>>>> CSE-3 >>>>> B-Tech 3rd Year >>>>> @MNNIT ALLAHABAD* >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> *UTKARSH SRIVASTAV >>>> CSE-3 >>>> B-Tech 3rd Year >>>> @MNNIT ALLAHABAD* >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to algogeeks@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> algogeeks+unsubscr...@googlegroups.com. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >>> >>> -- >>> Saurabh Singh >>> B.Tech (Computer Science) >>> MNNIT ALLAHABAD >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.