shell cut string
Sample:api-login-103923
to get the api
echo "api-login-103923"|cut -d"-" -f1
-d
is the seprator-f
is the index , starting from 1
Sample:api-login-103923
to get the api
echo "api-login-103923"|cut -d"-" -f1
-d
is the seprator-f
is the index , starting from 1
RPM编译时遇到这个问题
xecuting(%build): /bin/sh -e /var/tmp/rpm-tmp.HDvAfF
+ umask 022
+ cd /tmp/csmp-build-TLlpXrJT/BUILD
+ cd csmp-2.0.3sp1
+ $'\r'
/var/tmp/rpm-tmp.HDvAfF: line 29: $'\r': command not found
error: Bad exit status from /var/tmp/rpm-tmp.HDvAfF (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.HDvAfF (%build)
make: *** [rpm] Error 1
make: Leaving directory `/root/rpms/xxx'
打开这个文件/var/tmp/rpm-tmp.HDvAfF时,会看到29号有个特殊的字符 ^M
这个其实是CLRF 没转成LF的问题, linux上用yum install dos2unix,修改相应的文件 即 dos2unix filename
即可
//无需用户名和密码
export http_proxy=http://ip:port
export https_proxy=http://ip:port
//需要用户名和密码
export http_proxy=http://user:password@ip:port
export https_proxy=https://user:password@ip:port
curl -x <[protocol://][user:password@]proxyhost[:port]> url
--proxy <[protocol://][user:password@]proxyhost[:port]> url
--proxy http://user:password@Your-Ip-Here:Port url
-x http://user:password@Your-Ip-Here:Port url
如curl -x http://mike:123456@api.baidu.com:3392 https://www.zixi.org
cat /proc/sys/kernel/random/uuid
#!/usr/bin/python
import uuid
print uuid.uuid1()
print uuid.uuid4()
python3 适用,执行shell命令
import subprocess
def run(args):
out = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True)
stdout, stderr = out.communicate()
return stdout
print(run(['ls', '-l']))
import os
os.system('ps -ef')
import os
os.popen('ls')