linux find xargsshell:1、$# 和 $(2)

电脑杂谈  发布时间:2018-02-13 21:17:17  来源:网络整理

.hello.sh 或 source hello.sh #在当前shell环境中执行shell脚本【前三种执行shell是在当前shell[称为父shell],开启一个子shell环境,shell脚本执行完,子shell环境随即关闭,回到父shell环境】这种执行,是在当前shell中执行。

补充

shell远程执行:

ssh user@remoteNode "cd /home ; ls" #前提条件:配置ssh免密登录,命令间用分号隔开

执行sql脚本:

shell脚本调用sql脚本

#!/bin/csh

source /opt/info

dbaccess bpedb /opt/info/del.sql

6、指令将 ? 转为大写

tr ‘a-z‘ ‘A-Z‘ <filename #将filename文件中所有的小写字母转换为大写字母【tr 命令对标准输入的字符进行替换,压缩和删除。如tr -d ‘0-9‘ 表示删除数字】

6、将标准输出和标准错误输出定向到log.txt

2>&1 log.out 【标准输入 standard input 0,正确输出 standard output 1,错误输出 error output 2】

find / home -name lost* >allresult 2>&1 #首先将标准错误输出定向到标准输出,再将标准输出定向到allresult文件。

或 find /home -name lost* >& allresuilt

分析:find /home -name lost* > allresult 1>&2

find /home -name lost* 2> allresult 1>&2

find /home -name lost* 2>&1 > allresult

补充:

重定向操作符 -

(cd /source/directory && tar cf - .) | (cd /dest/directory && tar xvfp -) #把/source/directory目录下所有文件通过压缩解压缩,移动到/dest/directory这个目录下

n<&- 表示将n号输入关闭

<&- 表示关闭标准输入(键盘)

n>&- 表示将n号输出关闭

>&- 表示将标准输出关闭


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-76096-2.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 张振中
      张振中

      伊拉克是挺可怜的

    • 太武帝
      太武帝

      中国应该直接将闯入领海的美国军舰扣压

    • 张非
      张非

      这生意多好做啊”

    热点图片
    拼命载入中...