
여러 폴더의 파일을 단일 폴더로 수집한 다음 보관하는 컴퓨터에 간단한 스크립트(아래 제공)가 있습니다. 스크립트는 원격 시스템에서 예상대로 작동합니다. SSH()를 통해 실행하면 ssh user@machine -f 'path.to.script'
다음과 같은 결과가 나타납니다.
tar: toSend: Cannot stat: 해당 파일 또는 디렉터리 없음 tar: 이전 오류로 인해 종료가 지연되어 오류가 발생했습니다. 신호 1에 의해 종료되었습니다.
내가 도대체 뭘 잘못하고있는 겁니까?
#!/bin/bash
archfile=~/fastspace/toSend.tgz
dir=~/fastspace/toSend
if [ -f $archfile ] ; then
rm $archfile
fi
if [ -d $dir ]; then
rm -r $dir
fi
mkdir $dir
for i in {1..20}; do
cp ~/fastspace/prog/mn0.$i/resSum.dat $dir/res$i
cp ~/fastspace/prog/mn0.$i/parOut.dat $dir/pars$i
done
tar cvfz $archfile toSend
rm -r $dir