#!/bin/bash
export folder=`date -d "today - 1 days" '+%Y%m%d'`;
if filename in /r1/test/med_sms/FDA3A; then
result=
if filename = *$folder*; then
result= mv $filename /r1/test/med_sms/FDA3A/test
else
if filename = *$folder*; then
result= mv $filename /r1/test/med_sms/FDA3A/test
elif
done;
嗨..我正在尝试执行上面的scrpot,但它将异常抛出为./test1.sh:line 11:语法错误接近意外令牌`done'
./test1.sh: line 11: `done'
有人可以帮忙吗?
答案 0 :(得分:1)
if
Bash fi
语句以Value
答案 1 :(得分:1)
你不应该以这种方式使用ìf
elif
语句,根据你的程序结构,这应该是这样的:
export folder=`date -d "today - 1 days" '+%Y%m%d'`;
if filename in /r1/test/med_sms/FDA3A; then
result= something_here
elif filename = *$folder*; then
result= mv $filename /r1/test/med_sms/FDA3A/test
elif filename = *$folder*; then
result= mv $filename /r1/test/med_sms/FDA3A/test
else
result = PUT here the last condition
fi