I'm using system() and shell_exec() but it seems that this funcions use /bin/sh always. I want to use another shell when I call this functions: bash or zsh. Is it possible?
CodePudding user response:
What's the point? If you use system
to start another shell script, that shell script itself can decide (via its #!
line) which shell it is supposed to be processed by. Aside from this, you can always explicitly call the shell. For instance, if you want to take advantage of globbing operators specific to zsh or specific zsh builtins, you can do a
# Produce list of files including hidden files. Use
# the zsh-builtin command instead of /usr/bin/echo :
system('zsh -c "echo *(DN)"')
CodePudding user response:
One solution can be:
<?php
\system('bash -c "here your command"');
or
<?php
\system('zsh -c "here your command"');