代码搜索:bash
找到约 5,321 项符合「bash」的源代码
代码结果 5,321
www.eeworm.com/read/438832/7725331
sh factr.sh
#!/bin/bash
# factr.sh: 分解约数
MIN=2 # 如果比这个数小就不行了.
E_NOARGS=65
E_TOOSMALL=66
if [ -z $1 ]
then
echo "Usage: $0 number"
exit $E_NOARGS
fi
if [ "$1" -lt "$MIN" ]
then
echo "Number to facto
www.eeworm.com/read/438832/7725359
sh ex67.sh
#!/bin/bash
declare -a colors
# 脚本中所有的后续命令都会把
#+ 变量"colors"看作数组.
echo "Enter your favorite colors (separated from each other by a space)."
read -a colors # 至少需要键入3种颜色, 以便于后边的演示.
# 'read'命令的特
www.eeworm.com/read/438832/7725389
sh dereference.sh
#!/bin/bash
# dereference.sh
# 对一个传递给函数的参数进行解除引用的操作.
# 此脚本由Bruce W. Clare所编写.
dereference ()
{
y=\$"$1" # 变量名.
echo $y # $Junk
x=`eval "expr \"$y\" "`
echo $1=$x
eva
www.eeworm.com/read/438832/7725395
sh poem.sh
#!/bin/bash
# poem.sh: 将本书作者非常喜欢的一首诗, 漂亮的打印出来.
# 诗的行数(单节).
Line[1]="I do not know which to prefer,"
Line[2]="The beauty of inflections"
Line[3]="Or the beauty of innuendoes,"
Line[4]="The blackbird
www.eeworm.com/read/438832/7725398
sh array-function.sh
#!/bin/bash
# array-function.sh: 将数组传递到函数中与...
# 从函数中"返回"一个数组
Pass_Array ()
{
local passed_array # 局部变量.
passed_array=( `echo "$1"` )
echo "${passed_array[@]}"
# 列出这个新数
www.eeworm.com/read/438832/7725410
sh redir4.sh
#!/bin/bash
if [ -z "$1" ]
then
Filename=names.data # 如果没有指定文件名就使用默认值.
else
Filename=$1
fi
line_count=`wc $Filename | awk '{ print $1 }'`
# 目标文件的行数.
#
# 此处的代码太过做作, 并且写得很难
www.eeworm.com/read/438832/7725752
sh allprofs.sh
#!/bin/bash
# allprofs.sh: 打印所有用户的配置文件
# 由Heiner Steven编写, 并由本书作者进行了修改.
FILE=.bashrc # 在原始脚本中, File containing user profile,
#+ 包含用户profile的是文件".profile".
for home in `awk -F: '{p
www.eeworm.com/read/438832/7725772
sh str-test.sh
#!/bin/bash
# str-test.sh: 检查null字符串和未引用的字符串,
#+ but not strings and sealing wax, not to mention cabbages and kings . . .
#+ 但不是字符串和封蜡, 也并没有提到卷心菜和国王. . . ??? (没看懂, rojy bug)
# 使用 if [ ... ]
# 如果
www.eeworm.com/read/438832/7725781
sh ex62.sh
#!/bin/bash
# 函数内部的局部变量与全局变量.
func ()
{
local loc_var=23 # 声明为局部变量.
echo # 使用'local'内建命令.
echo "\"loc_var\" in function = $loc_var"
global_var=999 # 没有声明为局部