0
我正在vi中创建一个基本脚本。首先,我在Notepad ++中输入代码,当我准备好时,我将它复制到vi中。在某些时候,颜色完全改变。例如评论变成紫色。BASH中错误的vi颜色
搜索sintax错误和颜色解释,但没有成功。脚本似乎也行得通。有谁知道发生了什么?
#find system and last database partition date
system_date=`date '+%m%d%Y'`
database_date=$(find_last_partition_date)
# testing colour ...OK
#convert system and last database partition dates to unix time
# testing colour ...OK
unix_system_date=`date -d $(sed -r 's#(..)(..)(....)#\1/\2/\3#' <<<$system_date) +%s`
#testing colour ...purple not blue
unix_database_date=`date -d $(sed -r 's#(..)(..)(....)#\1/\2/\3#' <<<$database_date) +%s`
#testing colour
#compare them to determine the initial parameter
if ((unix_database_date > unix_system_date)); then
start_date=`date +"%m%d%Y" -d "${database_date:4}${database_date:0:4} + 1 day"`
else
start_date=`date '+%m%d%Y' -d "$actual_date+2 days"`
fi
cd /opt/data/apps/utils
################################################ 1st cycle ################################################
我有#!/ bin/bash但不在第一行。改成它是第一行,现在颜色没问题。谢谢您的帮助 ! – user3253335