AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-413481

NeverStopLearning's questions

Martin Hope
NeverStopLearning
Asked: 2018-03-22 02:04:06 +0800 CST

SED on Bash 脚本:如何用来自 Bash 脚本变量的特殊字符替换文本

  • 0

首先,在 bash 脚本中有一个包含特殊字符的变量。这是示例。列表.txt:

user = root
password = 1234

重击脚本:

#!/bin/sh
var1 = var&2018+&
find . -name "list.txt" -exec sed -i "s/1234/"$var1"/g" {} +

当我执行脚本时,结果是:var12342018+1234。

更新 1(奥利夫的回答):

var1='var&2018+&'
find . -name "*list.txt" -exec bash -c 'sed -i "s/1234/$2/g" $1' _ {} "$var1" \;

结果仍然:密码= var12342018+1234

也许任何人都可以帮助我。谢谢你

bash
  • 2 个回答
  • 1981 Views
Martin Hope
NeverStopLearning
Asked: 2018-01-29 21:24:57 +0800 CST

无法在 nginx 1.13 上使用 laravel 的域/子目录加载图像(错误 404)

  • 1

我无法加载保存在默认图像目录 laravel (laravelroot/public/images) 中的图像。我已经在http://domain/laravelroot 上设置了 laravel。这是配置:

server {
    listen 80;
    server_name localhost;
    index index.php;
    root /usr/share/nginx/html;

location / {
         try_files   $uri $uri/ /index.php?$query_string;
    }

location ~ /.well-known {
            allow all;
    }

location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
    access_log        off;
    log_not_found     off;
    expires           360d;
    }

location ^~ /laravelroot {  
            alias /usr/share/nginx/html/laravelroot/public;  
            try_files $uri $uri/ @laravelroot;  

            location ~ \.php {  
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.1-fpm.sock; 
                fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/laravelroot/public/index.php;
                }  
        }  

    location @laravelroot {
        rewrite /laravelroot/(.*)$ /laravelroot/index.php?/$1 last;  
    }

在 element inspect 上,它的域指的是http://localhost/imagefile。当我在新选项卡上打开图像时,将 url 更改为http://localhost/laravelroot/images/imagefile.png它已加载。

我试图将图像位置放在 laravelroot 指令中。

location ^~ /laravelroot {  
                alias /usr/share/nginx/html/laravelroot/public;  
                try_files $uri $uri/ @laravelroot;  

            location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
                  alias /usr/share/nginx/html/laravelroot/public/images;
                  access_log        off;
                  log_not_found     off;
                  expires           360d;
                  }

            location ~ \.php {  
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.1-fpm.sock; 
                fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/laravelroot/public/index.php;
                }  
        }  

并没有工作。花了几个小时,但今天没有任何线索

nginx
  • 1 个回答
  • 1730 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve