【问题标题】:Cannot place text inside file using linux无法使用linux在文件中放置文本
【发布时间】:2021-04-14 17:26:43
【问题描述】:

我已经在 AWS EC2 实例中安装了 moodle。但是 config.php 文件丢失了。我使用**创建了一个文件

触摸 config.php

** 命令。但我无法将我的内容放入该文件中。

我的内容是

<?php  // Moodle configuration file

unset($CFG); global $CFG; $CFG = new stdClass();

$CFG->dbtype    = 'mariadb'; $CFG->dblibrary = 'native'; $CFG->dbhost 
= 'localhost'; $CFG->dbname    = 'moodledb'; $CFG->dbuser    = 'root'; $CFG->dbpass    = 'pass'; $CFG->prefix    = 'mdl_'; $CFG->dboptions = array (   'dbpersist' => 0,   'dbport' => '',   'dbsocket' => '',   'dbcollation' => 'utf8mb4_general_ci', );

$CFG->wwwroot   = 'http://localhost/moodle'; $CFG->dataroot  = 'L:\\xampp\\moodledata'; $CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(__DIR__ . '/lib/setup.php');

我已使用 Windows 中的 Putty 连接到 AWS。

【问题讨论】:

    标签: linux file input putty


    【解决方案1】:

    使用cat 和heredoc:

    cat > config.php <<'EOF'
    your content
    goes here
    EOF
    

    你可以这样跳过touch。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-21
      • 2013-12-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多