首页 > 其他分享 >if [ "$1""xx" != "xx" ];then current_path=$1 fi汉语

if [ "$1""xx" != "xx" ];then current_path=$1 fi汉语

时间:2023-06-08 10:15:52浏览次数:33  
标签:代码 current xx 当前工作 参数 path

 

if [ "$1""xx" != "xx" ];then
    current_path=$1
fi

这段 sh 脚本代码是用来检查当前工作目录的。它的作用是,如果用户传递了一个参数 (比如 "xx"),而且该参数与当前工作目录不同,则将当前工作目录设置为传递的参数 (即 "xx")。

具体来说,代码中的 "if" 语句判断参数 $1 是否等于 "xx",如果是,那么代码不会执行任何操作,因为 $1 已经等于 "xx" 了。但是如果 $1 不等于 "xx",则代码会执行以下操作:

  1. 将当前工作目录设置为 $1,即当前目录会设置为传递的参数。
  2. 将变量 "current_path" 的值设置为 $1,以便在脚本后续的代码中使用该值。

需要注意的是,该代码假设传递的参数 "xx" 是一个有效的路径。如果参数不是有效的路径,则该代码可能会产生不可预料的结果。

标签:代码,current,xx,当前工作,参数,path
From: https://www.cnblogs.com/jarsing/p/17465357.html

相关文章

  • golang导入私有仓库报错:“server response: not found:xxx: invalid version: git ls
    1.问题:goget导入私有仓库报错➜goget"devops.gitlab.xxx.com/test/kafka-utils"go:devops.gitlab.xxx.com/test/[email protected]:verifyinggo.mod:devops.gitlab.xxx.com/testo/[email protected]/go.mod:readinghttps://goproxy.cn/sumdb/sum.golang.org/......
  • @Param、@PathVariable 和 @RequestParam的使用场景和区别
    @Param、@PathVariable和@RequestParam的使用场景和区别@Param注解:使用框架:MyBatis(持久层框架),一般只在xxxmapper.java上使用,当传输的数据超过一个时,需要使用它来取别名,否则数据库无法区分用途:指定方法参数与SQL查询参数的对应关系。场景:在MyBatis中,@Param注解用......
  • QA|重写了元素定位后报错xx object has no attribute 'find_element'|网页计算器自动
    代码如下:1#basepage.py23fromseleniumimportwebdriver456classBasePage():7"""8基类用作初始化封装常用操作9"""1011def__init__(self):12"""13初始化driver14......
  • Selenium+xpath爬取简书
    fromseleniumimportwebdriverimporttimefromlxmlimportetreeimportpymysqldriver=webdriver.Chrome()driver.get('https://www.jianshu.com/')#加载更多defload_mord(num):#通过观察发现,打开页面需要鼠标滑动大概5次左右才能出现阅读更多按钮for......
  • Failed to load resource: xxx 504 (Gateway Time-out)
    问题描述:上传文件js,报错如下:Failedtoloadresource:theserverrespondedwithastatusof504(GatewayTime-out) 问题原因:网络超时 解决办法:nginx配置 proxy_read_timeout150;location/{proxy_read_timeout150;//单位为秒}就是把超时时间调长一点,保证......
  • JDK 1.6 与 1.8 中的 ConcurrentHashMap 学习
    ConcurrentHashMap使用segment(继承ReentrantLock)和volatile来保证线程安全性segment的数量为16,每个segment中桶(HashEntry[])的数量可以增加,桶中放的是由HashEntry组成的链表;count表示segment中元素的数量,modCount统计导致结构变化操作的次数(put、remove、replace......
  • spingboot maven 使用简化配置 将本地包加入classpath
    不是使用dependencyManagement<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.1.6.RELEASE</version><relativePath......
  • ORA-01555:snapshot too old: rollback segment number X with name "XXXX" too small
    ORA-01555:snapshottooold:rollbacksegmentnumberXwithname"XXXX"toosmall在查询快照的时候select*fromtesttableasoftimestampto_timestamp('2023-04-0322:00:00','yyyy-mm-ddhh24:mi:ss')提示错误ORA-01555:snapshottooold:r......
  • 04 Xpath_[实例]爬取maoyan
    目录Xpathlxml库的安装和使用提取的内容代码生成的csv下载的图片参考文档Xpathlxml库的安装和使用提取的内容随意选取的一段节点包含的影片信息,如下所示:<dd> <iclass="board-indexboard-index-1">1</i> <ahref="/films/1200486"title="我不是药神"class="image-link&quo......
  • docker 部署xxx-job
    1拉取镜像:dockerpullxuxueli/xxl-job-admin:2.3.02创建容器:dockerrun-d--privileged-ePARAMS="--spring.datasource.url=jdbc:mysql://1.15.242.247:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=UTC--s......