美文网首页
初试shell脚本,确实高效

初试shell脚本,确实高效

作者: Cat丹 | 来源:发表于2019-11-13 16:24 被阅读0次

给变量赋值

savedir=dirpath/

列出文件夹中的所有文件

for file in $(ls dir/)
do
  echo $file
done

新建文件夹(注意:中括前后必须有空格)

if [ ! -d newdir/ ];then
    mkdir newdir/
else
    echo dir exist
fi

截取字符串

${model%.*} #截取$model字符串.前的字符

调用python

python test.py --arg1 x1 --arg2 x2

综合应用

#!/bin/bash
for model in $(ls weights/)
do
  echo $model
  savedir=result/${model%.*}_nocrop/
  echo $savedir
  if [ ! -d $savedir ];then
    mkdir $savedir
  else
    echo dir exist
  fi
  for dir in $(ls  testpic/)
  do
    echo $dir
    if [ ! -d $savedir/$dir ];then
        mkdir $savedir/$dir
    else
        echo dir exist
    fi
#    echo weights/$model
    python eval.py --trained_model=weights/$model --score_threshold=0.5 --top_k=15 --images=testpic/$dir:$savedir/$dir
  done
done

相关文章

  • 初试shell脚本,确实高效

    给变量赋值 列出文件夹中的所有文件 新建文件夹(注意:中括前后必须有空格) 截取字符串 调用python 综合应用

  • 初试Shell脚本

    背景 临上线前测试比较努力,遇到闪退或者其他问题,会把日志包打给我,由于app内存限制,目前每次打包都是1m大小,...

  • Shell入门笔记

    Shell脚本:Linux Shell脚本学习指南菜鸟教程 - Shell教程Linux入门 - Shell脚本是...

  • 2018-09-26

    shell脚本 1.1、什么是shell脚本(shell script , ...

  • Shell script + crontab实现Mysql定时备

    一、Shell 脚本 Shell 脚本(shell script),是一种为 shell 编写的脚本程序。 业界所...

  • 嵌入式day12

    shell脚本的本质 shell脚本语言是解释型语言 shell脚本的本质:shell命令的有序集合 shell编...

  • shell脚本

    什么是shell脚本 Shell 脚本(shell script),是一种为 shell 编写的脚本程序。业界所说...

  • Shell脚本语法

    1. Shell脚本简介Shell 脚本(shell script),是一种为 shell 编写的脚本程序。业界所...

  • shell脚本

    什么是Shell脚本 Shell脚本(英语:Shell script),又称Shell命令稿、程序化脚本,是一种电...

  • 【生物信息笔记】shell 脚本 (dry-2)

    shell 和 shell script(脚本)区别: shell 和 shell 脚本是两个不同概念,shell...

网友评论

      本文标题:初试shell脚本,确实高效

      本文链接:https://www.haomeiwen.com/subject/ysfkictx.html