
shell
在深圳搬砖
一入IT深似海,搬起砖来特别嗨
展开
-
shell关于目录和文件的一些操作
shell基本操作原创 2022-10-21 10:09:31 · 500 阅读 · 1 评论 -
shell读取文件每一行内容,追加写入到另一个文件
shell读取文件,写文件原创 2022-10-13 15:03:56 · 7578 阅读 · 0 评论 -
shell脚本实践2:自定义rm命令
linux系统的rm命令太危险,一不小心就会删除掉系统文件。 写一个shell脚本来替换系统的rm命令,要求当删除一个文件或者目录时,都要做一个备份,然后再删除。1. 简单的实现:假设有一个大的分区/data/,每次删除文件或者目录之前,都要先在/data/下面创建一个隐藏目录,以日期/时间命名,比如/data/.201703271012/,然后把所有删除的文件同步到该目录下面,可以使用rsy...原创 2019-11-12 17:40:12 · 1318 阅读 · 0 评论 -
shell脚本实践1:截取字符串
请根据以下要求截取出字符串中的字符:http://www.aaa.com/root/123.htm1.取出www.aaa.com/root/123.htm2.取出123.htm3.取出http://www.aaa.com/root4.取出http:5.取出http://6.取出www.aaa.com/root/123.htm7.取出1238.取出123.htm...原创 2019-11-12 14:58:38 · 340 阅读 · 0 评论 -
shell脚本学习(三)
test1:for循环#!/bin/bashfor var in one two three fourdo echo "The number is $var"doneecho "Now show read values from file"file="place"for var in $(cat $file)do echo "Visit bea...原创 2019-11-01 14:16:24 · 485 阅读 · 0 评论 -
shell脚本学习(二):文件比较等操作
对应《Linux命令行与shell脚本编程大全》 -- 章节12.4.3test1:-d file :检查目录#!/bin/bashdir="/home//shell/dir"if [ -d $dir ]then echo "dir is exist" cd $dir lselse echo "dir is not...原创 2019-11-01 11:16:22 · 241 阅读 · 0 评论 -
shell脚本学习(一)
test:简单命令的组合#!/bin/bashdatewho结果:2019年 11月 01日 星期五 10:34:27 CSTtty1 2019-10-17 01:40 (:0)pts/2 2019-11-01 09:03 (10.4.205.170)test1:echo的使用#!/bin/bashecho The time and ...原创 2019-11-01 10:57:03 · 260 阅读 · 0 评论