0
는 어떻게 DB에 연결하고이 지금까지 내 코드입니다삽입 값은
bash는 쿼리를 실행할 수 있습니다
echo "estacion: "$st;
fcha=$year2"-"$month"-"$day;
echo "fecha: "$fcha;
echo $archivoF " ==> " $rutabase"datos/obs/"$st"/"$year2"/"$archivoF;
if [ ! -d $rutabase"datos/obs/"$st"/"$year2 ]; then
mkdir -p $rutabase"datos/obs/"$st"/"$year2;
fi
mv $archivoF $rutabase"datos/obs/"$st"/"$year2
IFS='.' read -ra tipoO <<< "$archivoF"
tipoOb=`echo "."${tipoO[1]}"."${tipoO[2]}`
query="insert into FILES (name,type,date,station) VALUES($archivoF,$tipoOb,$fcha,$st)"
echo $archivoG " ==> "$rutabase"rinex/nav/"$st"/"$year2"/"$archivoG;
if [ ! -d $rutabase"datos/nav/"$st"/"$year2 ]; then
mkdir -p $rutabase"datos/nav/"$st"/"$year2;
fi
mv $archivoG $rutabase"datos/nav/"$st"/"$year2
IFS='.' read -ra tipoN <<< "$archivoG"
tipoNa=`echo "."${tipoN[1]}`
query="insert into FILES (name,type,date_f,station) VALUES($archivoG,$tipoOb,$fcha,$st)"
제안
mysql -e "쿼리 문자열" –
Barmar
문자열 값을 반드시 인용하십시오. – Barmar
과제에서'echo'를 사용하는 이유는 무엇입니까? 'tipoOb =. $ {tipoO [1]} ' – Barmar