Linux 语法错误:意外的文件结尾(应为“完成”)
我复制了SeisUnix(SU)的shell脚本,这是一个基于Linux的地震处理程序Linux 语法错误:意外的文件结尾(应为“完成”),linux,shell,unix,syntax-error,Linux,Shell,Unix,Syntax Error,我复制了SeisUnix(SU)的shell脚本,这是一个基于Linux的地震处理程序 #! /bin/sh #File: Nmigcvp2.sh # Create one panel for each migration velocity # Each panel has the same "fldr" value # The migration velocity is in key "offset" #
#! /bin/sh
#File: Nmigcvp2.sh
# Create one panel for each migration velocity
# Each panel has the same "fldr" value
# The migration velocity is in key "offset"
# Total number of panels is in key "nvs"
# Set messages on
##set -x
#================================================
# USER AREA -- SUPPLY VALUES
#------------------------------------------------
# Seismic files
indata=Nstack4.su # SU format
outdata=Nmigcvp.su # migration Constant Velocity Panels
# Migration variables
cdpmin=900 # Start CDP value
cdpmax=1300 # End CDP value
dxcdp=16.667 # distance between adjacent CDP bins (m)
smig=1.0 # stretch factor (0.6 typical if vrms increasing)
# [the "W" factor] (Default=1.0)
vscale=1.0 # scale factor to apply to velocities (Default=1.0)
lstaper=20 # length of side tapers (traces) (Default=0)
lbtaper=100 # length of bottom taper (samples) (Default=0)
# Velocity panel variables
firstv=1400 # first velocity value
lastv=2000 # last velocity value
increment=200 # velocity increment
numVtest=100 # use to limit number of velocity panels
# otherwise, use very large value (100)
#================================================
# Compute number of velocity panels
numV=`echo "( ( $lastv - $firstv ) / $increment ) + 1" |bc -l
if [ $numVtest -lt $numV ] ; then
numV=$numVtest
fi
#------------------------------------------------
# FILE DESCRIPTIONS
# tmp1 = binary temp file of input data
#------------------------------------------------
cp $indata tmp1
migV=$firstv
echo " "
#------------------------------------------------
# Loop through Migration Constant Velocity Panels
# Each panel has the same "fldr" value
# Panel migration velocity is in key "offset"
# Total number of panels (numV) is in key "nvs"
#------------------------------------------------
i=1
while [ $i -le $numV ]
do
echo " iteration number = $i Velocity = $migV"
suwind < tmp1 key=cdp min=$cdpmin max=$cdpmax |
sushw key=fldr a=$i |
sushw key=offset a=$migV |
sushw key=nvs a=$numV |
sustolt cdpmin=$cdpmin cdpmax=$cdpmax dxcdp=$dxcdp \
tmig=0 vmig=$migV smig=$smig vscale=$vscale \
lstaper=$lstaper lbtaper=$lbtaper \
>> $outdata
i=`expr $i + 1`
migV=`expr $migV + $increment`
done
#------------------------------------------------
# Remove files and exit
#------------------------------------------------
echo " "
echo " Output file = $outdata"
echo " "
rm -f tmp*
exit
行尾缺少一个`反勾字符。如果使用彩色语法编辑器,则更容易找到此类语法错误
./Nmigcvp2.sh: 33: Syntax error: end of file unexpected (expecting "done")
例如,在VIM中,使用设置语法
&颜色方案
。
您还可以计算行数设置nu
numV=`echo "( ( $lastv - $firstv ) / $increment ) + 1" |bc -l`