美文网首页
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脚本杂记

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