R
R
Roman Kilanov2021-02-25 11:11:13
bash
Roman Kilanov, 2021-02-25 11:11:13

How to write the path to the executable #!.... with spaces in the path?

Good afternoon! tell me how to write the full path to the file + taking into account the configuration parameters at the beginning of the script.
In this case, we are talking about Yii2 and its cli script ./yii
such a problem for poppy (maybe there is another solution) MAMP PRO in the WEB version loads one config file, and for the CLI version - another one. and I need it to work on the main.
I don’t want to bother with copying one to another, I just want to understand whether it is possible or not, if so, how.

its code is the following:

#!/usr/bin/env /Applications/MAMP/bin/php/php7.4.2/bin/php
<?php
/**
 * Yii console bootstrap file.
 *
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/yiisoft/yii2/Yii.php';

$config = require __DIR__ . '/config/console.php';

$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);


in this part of the line

#!/usr/bin/env /Applications/MAMP/bin/php/php7.4.2/bin/php


if you add the path to the config /Library/Application Support/appsolute/MAMP PRO/conf/php7.4.2.ini

like this:

#!/usr/bin/env /Applications/MAMP/bin/php/php7.4.2/bin/php -с /Library/Application Support/appsolute/MAMP PRO/conf/php7.4.2.ini


then it swears at spaces, and it doesn’t work to escape, neither a slash for a space, nor quotation marks

Could not open input file: Support/appsolute/MAMP

solutions in my thoughts, until I tried:
1. make a script (example: php_7.4.2_with_config) that will call

/Applications/MAMP/bin/php/php7.4.2/bin/php -с /Library/Application Support/appsolute/MAMP PRO/conf/php7.4.2.ini


and write it in ./yii

#!/usr/bin/env /usr/local/bin/php_7.4.2_with_config


2. find a solution for MAMP so that the config is loaded into the CLI, but apparently I didn’t look for something, I didn’t find it.

3. a solution to the correct use of ./yii with MAMP

4. another solution.

Thanks in advance. I'll try the first option for now, I came up with it while writing Question ))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alex-du, 2021-03-03
@Kilanoff

Try to make a symlink without spaces and use it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question