Ubuntu Shell编程中载入函数或者变量的方法
Ubuntu Shell编程中调用别的文件定义的函数或者变量的方法
- #!/bin/sh
- if [ -r backfunc ] ; then
- . /home/fef/shell/backfunc #"."后面有个空格,并且backfunc必须使用绝对路径!!
- else
- echo "`basename $0` cannot locate backfunc file"
- fi
- echo -n "Enter the code name: "
- if [ "$CODE" != "$_CODE" ] ; then
- echo "Wrong code... exiting... will use default"
- exit 1
- fi
- echo "The environment config file reports"
- echo "FULL backup Required : $_FULLBACKUP"
- echo "$LOGFILE"
- #!/bin/sh
- # name: backfunc
- # config file that holds the defaults for the archive systems
- _CODE="comet"
- _FULLBACKUP="yes"
- _LOGFILE="/logs/backup"
- _DEVICE="/dev/rmt/On"
- _INFORM="yes"
- _PRINT_STATS="yes"
得到的结果:
The environment config file reports
FULL backup Required : yes
相关推荐
IT之家 2020-03-11
graseed 2020-10-28
zbkyumlei 2020-10-12
SXIAOYI 2020-09-16
jinhao 2020-09-07
impress 2020-08-26
liuqipao 2020-07-07
淡风wisdon大大 2020-06-06
yoohsummer 2020-06-01
chenjia00 2020-05-29
baike 2020-05-19
扭来不叫牛奶 2020-05-08
hxmilyy 2020-05-11
黎豆子 2020-05-07
xiongweiwei00 2020-04-29
Cypress 2020-04-25
冰蝶 2020-04-20