有趣shell

ntpdate  0.cn.pool.ntp.org   #同步到时间池

# 每天5点10分执行同步任务
10 5 * * * root (/usr/sbin/ntpdate 0.cn.pool.ntp.org && /sbin/hwclock -w) &> /var/log/ntpdate.log

# 设置时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

######时间池服务器########
0.pool.ntp.org 有域名负载均衡

0.cn.pool.ntp.org 有域名负载均衡

ntp.tuna.tsinghua.edu.cn 清华大学

time.windows.com 微软
#########################

 

ssh -t xxx.xxx.xxx.xxx "cd /directory_wanted ; bash"   #切换到指定目录

echo data &> file.txt       # 标准输出和标准出错数据重定向到 file.txt文件

 

## cmake中使用DL函数库
target_link_libraries(RePlex lib ${CMAKE_DL_LIBS})

The set command enables options within a script。At the point in the script where you want the options to take effect, use 

       set -o option-name or, in short form, set -option-abbrev。

Disable an option within a script

        set +o option-name or set +option-abbrev.

Bash Options 

-B	brace expansion	Enable brace expansion (default setting = on)
+B	brace expansion	Disable brace expansion
-C	noclobber	Prevent overwriting of files by redirection (may be overridden by >|)
-D	(none)	List double-quoted strings prefixed by $, but do not execute commands in script
-a	allexport	Export all defined variables
-b	notify	Notify when jobs running in background terminate (not of much use in a script)
-c ...	(none)	Read commands from ...
checkjobs	 	Informs user of any open jobs upon shell exit. Introduced in version 4 of Bash, and still "experimental." Usage: shopt -s checkjobs (Caution: may hang!)
-e	errexit	Abort script at first error, when a command exits with non-zero status (except in until or while loops, if-tests, list constructs)
-f	noglob	Filename expansion (globbing) disabled
globstar	globbing star-match	Enables the ** globbing operator (version 4+ of Bash). Usage: shopt -s globstar
-i	interactive	Script runs in interactive mode
-n	noexec	Read commands in script, but do not execute them (syntax check)
-o Option-Name	(none)	Invoke the Option-Name option
-o posix	POSIX	Change the behavior of Bash, or invoked script, to conform to POSIX standard.
-o pipefail	pipe failure	Causes a pipeline to return the exit status of the last command in the pipe that returned a non-zero return value.
-p	privileged	Script runs as "suid" (caution!)
-r	restricted	Script runs in restricted mode (see Chapter 22).
-s	stdin	Read commands from stdin
-t	(none)	Exit after first command
-u	nounset	Attempt to use undefined variable outputs error message, and forces an exit
-v	verbose	Print each command to stdout before executing it
-x	xtrace	Similar to -v, but expands commands
-	(none)	End of options flag. All other arguments are positional parameters.
--	(none)	Unset positional parameters. If arguments given (-- arg1 arg2), positional parameters set to arguments.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值