代码搜索:bash
找到约 5,321 项符合「bash」的源代码
代码结果 5,321
www.eeworm.com/read/458682/7291739
sh patt-matching.sh
#!/bin/bash
# patt-matching.sh
# Pattern matching using the # ## % %% parameter substitution operators.
var1=abcd12345abc6789
pattern1=a*c # * (wild card) matches everything between a - c.
echo
e
www.eeworm.com/read/458682/7291762
sh arglist.sh
#!/bin/bash
# arglist.sh
# Invoke this script with several arguments, such as "one two three".
E_BADARGS=65
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` argument1 argument2 etc."
exit $E_BAD
www.eeworm.com/read/458682/7291774
sh seconds.sh
#!/bin/bash
TIME_LIMIT=10
INTERVAL=1
echo
echo "Hit Control-C to exit before $TIME_LIMIT seconds."
echo
while [ "$SECONDS" -le "$TIME_LIMIT" ]
do
if [ "$SECONDS" -eq 1 ]
then
units=second
www.eeworm.com/read/438832/7725437
sh vartrace.sh
#!/bin/bash
trap 'echo "VARIABLE-TRACE> \$variable = \"$variable\""' DEBUG
# 当每个命令执行之后, 就会打印出$variable的值.
variable=29
echo "Just initialized \"\$variable\" to $variable."
let "variable *= 3"
echo
www.eeworm.com/read/438832/7725737
sh erase.sh
#!/bin/bash
# erase.sh: 在读取输入时使用"stty"来设置一个擦除字符.
echo -n "What is your name? "
read name # 试试用退格键
#+ 来删除输入的字符.
#
www.eeworm.com/read/438832/7725748
sh secret-pw.sh
#!/bin/bash
# secret-pw.sh: 保护密码不被显示
echo
echo -n "Enter password "
read passwd
echo "password is $passwd"
echo -n "If someone had been looking over your shoulder, "
echo "your password would have be
www.eeworm.com/read/438832/7725789
sh ex71c.sh
#!/bin/bash
# 一个使用'cat'的here document, 但是禁用了参数替换.
NAME="John Doe"
RESPONDENT="the author of this fine script"
cat <<'Endofmessage'
Hello, there, $NAME.
Greetings to you, $NAME, from $RESP
www.eeworm.com/read/438832/7725792
sh ex9.sh
#!/bin/bash
# 变量赋值和替换
a=375
hello=$a
#-------------------------------------------------------------------------
# 强烈注意, 在赋值的的时候, 等号前后一定不要有空格.
# 如果出现空格会怎么样?
# "VARIABLE =value"
# ^
#% 脚本
www.eeworm.com/read/438832/7725802
sh nested-loop.sh
#!/bin/bash
# nested-loop.sh: 嵌套的"for"循环.
outer=1 # 设置外部循环计数.
# 开始外部循环.
for a in 1 2 3 4 5
do
echo "Pass $outer in outer loop."
echo "---------------------"
inner=1 # 重置
www.eeworm.com/read/438832/7725884
sh seconds.sh
#!/bin/bash
TIME_LIMIT=10
INTERVAL=1
echo
echo "Hit Control-C to exit before $TIME_LIMIT seconds."
echo
while [ "$SECONDS" -le "$TIME_LIMIT" ]
do
if [ "$SECONDS" -eq 1 ]
then
units=second