美文网首页
shell脚本杂记

shell脚本杂记

作者: jameiShi | 来源:发表于2019-01-10 16:34 被阅读9次

1.文件上传

    curl http://39.106.212.106/Demo/upload_file.php -F "file=@/Users/shijianmei/Downloads/erweima1.png" -F "version=123456789" -v

2.把shell 执行结果赋值给变量:

  • ,(尖号)把命令括起来,然后赋值给变量
dir=`pwd`
  • 采用 变量=$(pwd)
dir=$(pwd)

3.如果目录下的文件夹不存在,则创建

dirname="${export_path}/manifest"
echo "the dir name is $dirname"
if [ ! -d $dirname  ];then
  mkdir -p $dirname#-p表示支持多级目录
else
  echo manifest exist
fi

4.写文件到目录下

mainfestPlistPath="a/manifest.plist"
cat << EOF > ${mainfestPlistPath}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>items</key>
    <array>
        <dict>
            <key>assets</key>
            <array>
                <dict>
                    <key>kind</key>
                    <string>software-package</string>
                    <key>url</key>
                    <string></string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>display-image</string>
                    <key>url</key>
                    <string></string>
                </dict>
                <dict>
                    <key>kind</key>
                    <string>full-size-image</string>
                    <key>url</key>
                    <string></string>
                </dict>
            </array>
            <key>metadata</key>
            <dict>
                <key>bundle-identifier</key>
                <string>com.ucarinc.xxx</string>
                <key>bundle-version</key>
                <string>2.0.0</string>
                <key>kind</key>
                <string>software</string>
                <key>title</key>
                <string>MMCApp</string>
            </dict>
        </dict>
    </array>
</dict>
</plist>
EOF=

5.上传文件夹到linux
scp -r 1822555_bao.mmcbao.cn_apache/ root@39.106.212.106:/etc/httpd
scp -r 1822555_bao.mmcbao.cn_apache/a.mp3 root@39.106.212.106:/etc/httpd

6.从 远程linux服务器 复制到 本地

scp root@www.cumt.edu.cn:/home/root/others/music /home/space/music/1.mp3
scp -r www.cumt.edu.cn:/home/root/others/ /home/space/music/

相关文章

  • Shell脚本杂记

    1.判断字符串是否为空 2.函数返回字符串 Shell的函数默认只支持返回状态码(整数),不支持字符串。如果想要返...

  • shell脚本杂记

    1.文件上传 2.把shell 执行结果赋值给变量: 用,(尖号)把命令括起来,然后赋值给变量 采用 变量=$...

  • 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/kgvarqtx.html