概述
转换为大写字母
#!/bin/bash
upper() {
# Usage: upper "string"
printf '%sn' "${1^^}"
}upper $1
文本内容排序
sorted_file_name.py
#! /usr/bin/env python3file=open("use_IInterface.txt", "r")
lines = file.readlines()
file.close()
lines.sort()file=open("sorted_use_IInterface.txt", "w")
for line in lines:
file.write(line)
file.flush()
file.close()
git pull 整个目录下的git仓库
#! /bin/bash
function read_dir(){
for file in `ls $1` #注意此处这是两个反引号,表示运行系统命令
do
if [ -d $1"/"$file ] #注意此处之间一定要加上空格,否则会报错
then
read_dir $1"/"$file
else
echo $1"/"$file #在此处处理文件即可
fi
done
}function read_sub_dir(){
#for subdir in `ls $1`;
for subdir in $1;
do
if [ -d ${subdir} ]
then
echo ${subdir}
if [ -d ${subdir}/.git ]
then
#cd ${subdir} && git pull -q && cd ..
cd ${subdir} && git pull && cd ..
fi
fi
done
}function read_local_sub_dir(){
for subdir in `ls $(pwd)`;
do
if [ -d ${subdir} ]
then
echo ${subdir}
if [ -d ${subdir}/.git ]
then
cd ${subdir} && git pull && cd ..
fi
fi
done
}if [ $# == 1 ]
then
read_sub_dir $1
else
read_local_sub_dir
fi
~/.bashrc
84 # some more ls aliases
85 alias ll='ls -alF'
86 alias la='ls -A'
87 alias l='ls -CF'
88 alias pa='ps aux'
adbpush.sh
#!/bin/bash
apkfile="com.routon.piatosservice.apk PiatFloatWindow-release.apk PiatInit-release.apk PiatPlayer-release.apk PiatServMain-release.apk PiatServWatchdog-release.apk sougoushurufa.apk IncomingCheck-release.apk PiatHttpcomm-release.apk PiatKeypadServer-release.apk PiatProgramUpdate-release.apk PiatServParam-release.apk PiatSettings-release.apk T9PinyinIME-release.apk PiatCoreCtrl-release.apk PiatiBeacon-release.apk PiatLauncher-release.apk PiatServLog-release.apk PiatServUpdate-release.apk ScreenSaverService.apk"
for f in $apkfile
do
echo $f
adb push $f /system/app/ #此处可换成$1表示目录可替换
done
最后
以上就是苹果大炮为你收集整理的Linux Shell/python等脚本总结的全部内容,希望文章能够帮你解决Linux Shell/python等脚本总结所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复