1 Star 0 Fork 0

cym504875043/文档手册

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
often.md 761 Bytes
一键复制 编辑 原始数据 按行查看 历史
cym504875043 提交于 3年前 . 修改shell内容

常用的一些命令

  • 变量当作变量名使用
name='content'
content=$(ls -l)
test=`eval echo '$'"$name"`
echo test #就是执行ls -l的内容
  • 文件夹相关
#获取所有的文件夹
ls -l | awk '/^d/ {print $NF}'
#判断文件夹是否存在
if [ ! -d $dirPath ]; then
    mkdir $dirPath
fi
  • 文件相关
#获取所有的文件
ls -l | awk '/^-/ {print $NF}'
#判断文件是否存在
if [ ! -f $filePath ]; then
    echo "" > test.txt
fi
  • 循环
for dir in $dirs;do
    echo $dir
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/jike/doc-man.git
git@gitee.com:jike/doc-man.git
jike
doc-man
文档手册
master

搜索帮助