Quantcast

howto change shell on Linux

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

howto change shell on Linux

ivana richterova
Hi all,

I'd like to change shell used for system calls on linux. I quess it
should work the same way as Unix according to manual (set SHELL
env_var) but it doesn't.

On
#Linux deimos 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3 (2015-04-23)
x86_64 GNU/Linux
#GNU bash, version 4.3.33(1)-release (x86_64-pc-linux-gnu)

I get:
#> export SHELL=/bin/bash; gnuplot -d -e 'pr system("echo $0 $SHELL")'
# sh /bin/bash

Does anybody know how to change shell used by gnuplot on linux?

thanks

Iva

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto change shell on Linux

ivana richterova
ps. the gnuplot version is 5.0 patchlevel 5    (last modified 2016-10-02)

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto change shell on Linux

Ethan A Merritt-2
In reply to this post by ivana richterova
On Saturday, 17 December 2016 01:48:53 PM ivana richterova wrote:
> Hi all,
>
> I'd like to change shell used for system calls on linux. I quess it
> should work the same way as Unix according to manual (set SHELL
> env_var) but it doesn't.

Gnuplot uses the system() call, which always uses /bin/sh
See man (3) system:

SYNOPSIS
       #include <stdlib.h>

       int system(const char *command);

DESCRIPTION
       The  system()  library  function uses fork(2) to create a child process that exe‐
       cutes the shell command specified in command using execl(3) as follows:

           execl("/bin/sh", "sh", "-c", command, (char *) 0);


So no, it is not possible to change the shell used for a system call.


>
> On
> #Linux deimos 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3 (2015-04-23)
> x86_64 GNU/Linux
> #GNU bash, version 4.3.33(1)-release (x86_64-pc-linux-gnu)
>
> I get:
> #> export SHELL=/bin/bash; gnuplot -d -e 'pr system("echo $0 $SHELL")'
> # sh /bin/bash
>
> Does anybody know how to change shell used by gnuplot on linux?
>
> thanks
>
> Iva
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> gnuplot-info mailing list
> [hidden email]
> Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto change shell on Linux

BBands
Could write your commands to a file and select the shell via a sha-bang?

#!/bin/bash
# Proper header for a Bash script.

# Some other possibilities

#!/bin/sh
#!/bin/bash
#!/usr/bin/perl
#!/usr/bin/tcl
#!/bin/sed -f
#!/bin/awk -f

    John


On Sat, Dec 17, 2016 at 9:38 AM, Ethan A Merritt <[hidden email]>
wrote:

> On Saturday, 17 December 2016 01:48:53 PM ivana richterova wrote:
> > Hi all,
> >
> > I'd like to change shell used for system calls on linux. I quess it
> > should work the same way as Unix according to manual (set SHELL
> > env_var) but it doesn't.
>
> Gnuplot uses the system() call, which always uses /bin/sh
> See man (3) system:
>
> SYNOPSIS
>        #include <stdlib.h>
>
>        int system(const char *command);
>
> DESCRIPTION
>        The  system()  library  function uses fork(2) to create a child
> process that exe‐
>        cutes the shell command specified in command using execl(3) as
> follows:
>
>            execl("/bin/sh", "sh", "-c", command, (char *) 0);
>
>
> So no, it is not possible to change the shell used for a system call.
>
>
> >
> > On
> > #Linux deimos 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3 (2015-04-23)
> > x86_64 GNU/Linux
> > #GNU bash, version 4.3.33(1)-release (x86_64-pc-linux-gnu)
> >
> > I get:
> > #> export SHELL=/bin/bash; gnuplot -d -e 'pr system("echo $0 $SHELL")'
> > # sh /bin/bash
> >
> > Does anybody know how to change shell used by gnuplot on linux?
> >
> > thanks
> >
> > Iva
> >
> > ------------------------------------------------------------
> ------------------
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> > _______________________________________________
> > gnuplot-info mailing list
> > [hidden email]
> > Membership management via: https://lists.sourceforge.net/
> lists/listinfo/gnuplot-info
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> gnuplot-info mailing list
> [hidden email]
> Membership management via: https://lists.sourceforge.net/
> lists/listinfo/gnuplot-info
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
gnuplot-info mailing list
[hidden email]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
Loading...