shell脚本
来源:互联网 发布:floyd算法 路径 编辑:程序博客网 时间:2024/06/08 03:39
小技巧:
1 创建链接文件:"cp -l file1 file2 可以创建硬连接,cp -s file1 file2 创建硬链接文件"。类似: ln -l file1 file2 ; ln -s file1 file2。
2 新建一个文件:> filename , 类似 touch filename。
#!/bin/bash
my_FileName=test
src_Path=/app/$my_FileNamedst_Path=/sdcard/$my_FileName
#判断一个文件是否存在,并看它是否是链接文件
if [ -f $src_Path ] && [ ! -L $src_Path ]; then
mv $src_Path $dst_Path
if [ $? -eq 0 ]; then
echo "mv OK."
fi
#创建软链接文件。
ln -s $dst_Path $src_Path
if [ $? -eq 0 ]; thenecho "Generate link file,OK."
fi
else
echo "Warning:"
echo ">>>>>>>File is not here or it's a link file."
fi
0 0
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- shell 脚本
- SHELL 脚本
- shell脚本
- shell脚本
- shell 脚本
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- 快速幂+费马小定理 690D2 - The Wall (medium)CF
- HTML5与HTML4的区别
- SQL Server的触发器用法
- **PYTHON** 函数
- c++ inline 的一些小知识
- shell脚本
- 判断单链表是否含环
- Mysql常见sql
- 【usaco 2013 feb Bronze】信息传递
- 以下是C++的不同数据类型值的比较语句,请问这些判断语句中作为条件部分的语句编写有问题的有:
- 什么是html5
- 《Windows程序设计》读书笔十 菜单和其他资源
- 网络框架-volley
- 7.2 相关向量机