nohup.bash

来自「UNIX下SH的实现源码」· BASH 代码 · 共 52 行

BASH
52
字号
## BASH VERSION OF nohup COMMAND#ctype(){	path=$(builtin type -p $cmd | sed 1q)	if [ -n "$path" ]; then		echo "$path"		return 0	else		case "$cmd" in		*/*)	[ -x "$cmd ] && { echo "$cmd" ; return 0; } ;;		  *)	case "$(builtin type -t $cmd)" in			"")	return 1;;			*)	echo "$cmd" ; return 0;;			esac ;;		esac	fi	return 1}trap '' HUP		# ignore hangupcommand=$(ctype "$1")oldmask=$(umask)umask u=rw,og=		# default mode for nohup.outexec 0< /dev/null	# disconnect inputif [ -t 1 ]; then	# redirect output if necessary	if [ -w . ]; then		echo 'Sending output to nohup.out'		exec >> nohup.out	else	echo "Sending output to $HOME/nohup.out"		exec >> $HOME/nohup.out	fifiumask "$oldmask"# direct unit 2 to a fileif [ -t 2 ]; then	exec 2>&1fi# run the commandcase $command in*/*)	exec "$@"	;;time)	eval "$@"	;;*)	"$@"	;;esac

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?