Shell script learning call script package file zip method example



This article mainly introduces the relevant information about calling scripts to package files into zip, which is shared for your reference and learning. Let’s take a look at the detailed introduction:

Recently, I just touched shell script and wrote a little simple practice. Here is a python call script to perform the packaging operation.

The method is as follows:

The first step is to create a script:

 zip -P $zip_psw /data/frontend/tmp/$ $client/*
if [ "x$1" = "xzip" ];then
 cd -

Step 2: call the script

I use the script file called by Python to execute. Pay attention to the character format passed in. I write exec_shell in public class here

exec_shell(self, '/bin/sh /data/root/sbin/ zip ' + CLIENT + ' "' + zip_psw + '" ' + zip_name)
#Specific methods
import commands
def exec_shell(self, shell):
 (status, out) = commands.getstatusoutput(shell)
 If (status! = 0): ා script execution failed
 self.log.debug("exec [%s] fail. out=%s"%(shell, out))
 self.log.debug("exec [%s] success. out=%s"%(shell, out))
 return (status, out)


The above is the whole content of this article. I hope that the content of this article can bring some help to your study or work. If you have any questions, you can leave a message to exchange. Thank you for your support for developepaer.

Recommended Today

The application of USB camera in rk3399

The application of USB camera in rk3399 1, introduction UVCFull nameUSB Video Class, is a set of standard customized by usb-if. All USB interface cameras complying with this standard can almost be used directly under Windows Linux and other systems, achieving the similar effect of drive free. Of course, it doesn’t mean that there is […]