代码搜索:bash
找到约 5,321 项符合「bash」的源代码
代码结果 5,321
www.eeworm.com/read/441132/7675466
init sshd.init
#! /bin/bash
#
# $Id: sshd.init,v 1.3 2001/11/03 19:09:33 tim Exp $
#
### BEGIN INIT INFO
# Provides:
# Required-Start: $network
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# De
www.eeworm.com/read/438832/7725323
sh file-comparison.sh
#!/bin/bash
ARGS=2 # 脚本需要两个参数.
E_BADARGS=65
E_UNREADABLE=66
if [ $# -ne "$ARGS" ]
then
echo "Usage: `basename $0` file1 file2"
exit $E_BADARGS
fi
if [[ ! -r "$1" || ! -r "$2" ]]
then
echo "
www.eeworm.com/read/438832/7725350
sh match-string.sh
#!/bin/bash
# match-string.sh: 简单的字符串匹配
match_string ()
{
MATCH=0
NOMATCH=90
PARAMS=2 # 此函数需要2个参数.
BAD_PARAMS=91
[ $# -eq $PARAMS ] || return $BAD_PARAMS
case "$1" in
"$2") return
www.eeworm.com/read/438832/7725404
sh ex17.sh
#!/bin/bash
# 作为用例, 调用这个脚本至少需要10个参数, 比如:
# ./scriptname 1 2 3 4 5 6 7 8 9 10
MINPARAMS=10
echo
echo "The name of this script is \"$0\"."
# 添加./是表示当前目录
echo "The name of this script is \"`basename $
www.eeworm.com/read/438832/7725408
sh du.sh
#!/bin/bash
# Du.sh: DOS到UNIX文本文件的转换.
E_WRONGARGS=65
if [ -z "$1" ]
then
echo "Usage: `basename $0` filename-to-convert"
exit $E_WRONGARGS
fi
NEWFILENAME=$1.unx
CR='\015' # 回车.
# 0
www.eeworm.com/read/438832/7725739
sh keypress.sh
#!/bin/bash
# keypress.sh: 检测用户按键("hot keys").
echo
old_tty_settings=$(stty -g) # 保存老的设置(为什么?).
stty -icanon
Keypress=$(head -c1) # 或者使用$(dd bs=1 count=1 2> /dev/null)
www.eeworm.com/read/438832/7725743
sh ex34.sh
#!/bin/bash
# script "set-test"
# 使用3个命令行参数来调用这个脚本,
# 比如, "./set-test one two three".
echo
echo "Positional parameters before set \`uname -a\` :"
echo "Command-line argument #1 = $1"
echo "Command
www.eeworm.com/read/438832/7725773
sh assert.sh
#!/bin/bash
# assert.sh
assert () # 如果条件为false,
{ #+ 那么就打印错误信息并退出脚本.
E_PARAM_ERR=98
E_ASSERT_FAILED=99
if [ -z "$2" ] # 传递进来的参数个数不够.
the
www.eeworm.com/read/438832/7725785
sh timeout.sh
#!/bin/bash
# timeout.sh
# 由Stephane Chazelas所编写,
#+ 本书作者做了一些修改.
INTERVAL=5 # 超时间隔
timedout_read() {
timeout=$1
varname=$2
old_tty_settings=`stty -g`
stty -icanon min 0 time
www.eeworm.com/read/438832/7725787
sh array-ops.sh
#!/bin/bash
# array-ops.sh: 更多有趣的数组用法.
array=( zero one two three four five )
# 数组元素 0 1 2 3 4 5
echo ${array[0]} # 0
echo ${array:0} # 0
# 第一个