@rahul and @suarabh the program is giving different output on ubuntu and
redhat.......................... is ubuntu and redhat deals shell
differently

On Thu, Sep 15, 2011 at 9:45 AM, rahul vatsa <[email protected]> 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 <[email protected]>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 <
>> [email protected]> 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 <
>>> [email protected]> 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 <[email protected]>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 
>>>>> <[email protected]>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 
>>>>>> <[email protected]>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 <
>>>>>>> [email protected]> 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 [email protected].
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> [email protected].
>>>>>>>> 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 [email protected].
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> [email protected].
>>>>>>> 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 [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected].
>>>>> 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 [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to