当前位置: 首页 > news >正文

sed(学习)

1、清除环境变量

​​​​​​profile=~/.bash_profile
sed -i 's#export LD_LIBRARY_PATH=.*##g' $profile

2、设置环境变量(替换值)

sed -i 's#export LD_LIBRARY_PATH=.*#export LD_LIBRARY_PATH=/opt/testlinux/lib#g' ~/.bash_profile

3、修改配置文件

sdk_dir=/root/test

log_dir=/root/test

  #修改cg-casb.properties参数
  sed -i 's#SDK_BASE_PATH=.*#SDK_BASE_PATH='$sdk_dir'/testlinux#g' $plugin_dir/cg-casb.properties
  sed -i 's#LOG_PATH=.*#LOG_PATH='$log_dir'#g' $plugin_dir/cg-casb.properties
  sed -i 's#/opt/casb/logs/plugin#'$log_dir'#g' $plugin_dir/aoelog.xml

4、export设置环境变量

plugin_dir=/root/test

sdk_dir=root/test

if [ -f ~/.bash_profile ];then
    check_path=`cat  ~/.bash_profile | grep PLUGIN_PATH`
    if [ "$check_path" = "" ];then
      echo "export PLUGIN_PATH=$plugin_dir" >> ~/.bash_profile
    else
    if [ -z $PLUGIN_PATH ];then
      echo "export PLUGIN_PATH=$plugin_dir" >> ~/.bash_profile
    else
      sed -i 's#export PLUGIN_PATH=.*#export PLUGIN_PATH='$plugin_dir':'$PLUGIN_PATH'#g' ~/.bash_profile
    fi
fi

  if [ -f ~/.bash_profile ];then
    check_path=`cat  ~/.bash_profile | grep LD_LIBRARY_PATH`
    if [ -z $check_path ];then
      echo "export LD_LIBRARY_PATH=$sdk_dir/testlinux/lib" >> ~/.bash_profile
    else
    if [ -z $LD_LIBRARY_PATH ];then
      echo "export LD_LIBRARY_PATH=$sdk_dir/testlinux/lib" >> ~/.bash_profile
    else
      source ~/.bash_profile
      sed -i 's#export LD_LIBRARY_PATH=.*#export LD_LIBRARY_PATH='$sdk_dir'/testlinux/lib:'$LD_LIBRARY_PATH'#g'  ~/.bash_profile
    fi
fi

http://www.lryc.cn/news/60072.html

相关文章:

  • B - GCD Subtraction
  • 解决Failed to load ApplicationContext问题的思路
  • 基于CAMX大气臭氧来源解析模拟与臭氧成因分析实践技术应用
  • 异常的讲解 (1)
  • Prometheus - Grafana 监控 MySQLD Linux服务器 demo版
  • 应届生,实力已超6年,太卷了!
  • 0-1背包问题
  • VUE前端项目环境搭建
  • VMware安装Win2000安装程序闪退重启等问题的解决方法
  • 【id:45】【20分】A. Equation(类与对象+构造)
  • 数据库事务
  • Macbook(苹果电脑) VSCode 创建简单c++程序 配置C++开发环境
  • 如何使用 Matlab 构建深度学习模型
  • PDF怎么转CAD文件?(免费!高效转换方法汇总)
  • 经历了野蛮生长之后,新科技或许已经抵达了全新的临界点
  • Segment Anything论文翻译,SAM模型,SAM论文,SAM论文翻译;一个用于图像分割的新任务、模型和数据集;SA-1B数据集
  • EMQX vs NanoMQ | 2023 MQTT Broker 对比
  • RabbitMQ实现消息的延迟推送或延迟发送
  • 解决python中import导入自己的包呈现灰色 无效的问题
  • 消息中间件对比
  • nodejs+vue 高校校园食堂餐品在线订购网
  • SpringBoot【运维实用篇】---- SpringBoot程序的打包与运行
  • 10万字智慧政务数据中心平台建设方案
  • 使用 TensorFlow 构建机器学习项目:1~5
  • 【store商城项目08】删除用户的收获地址
  • SpringBooot
  • 测牛学堂:2023软件测试linux和shell脚本入门系列(shell的运算符)
  • TensorFlow 2.0 快速入门指南:第三部分
  • webpack介绍
  • SpringBoot 面试题汇总