У меня есть программа java, которую я пытаюсь сгенерировать 3 выхода, а затем переименовать их в зависимости от того, изначально был вызван исходный файл.Использование Bash для автоматизации создания тестовых выходов
Проблема в том, что перемещается только входной файл. Я думаю, что это может быть проблемой относительно относительных команд файла.
Вот мой сценарий. (Кроме того, я открыт для предложений о внесении этого сценария лучше выглядит. Я Баш новичок.)
#!/bin/bash
########################################################
#This script compiles Main, then attempts to run each #
#test case. After running a test case, it renames the #
#testcase and moves it to a new directory. #
########################################################
#echo `pwd` <---- This was used for testing. pwd is correct
#Gets contents of "tests" directory, stores them into the array
#without the file extension.
list=(`ls tests| sed 's/\.txt$//g'`)
#Compiles Main.java
cd ./src
javac Main.java
cd '../'
mv -f src/*.class bin #*/ (formatting fix)
#Runs Main for each test case, then renames and moves the test cases.
for filename in ${list[@]}
do
echo 1 > input.txt
echo tests/$filename.txt >> input.txt
cd ./bin # Why do I need to cd to make this work?
java bin/Main < input.txt
cd ../
mv -f input.txt "scriptout/'$filename'_input.txt"
mv -f "tests/output.txt" "scriptout/'$filename'_output.txt"
mv -f "tests/listing.txt" "scriptout/'$filename'_listing.txt"
mv -f "src/intermediate.txt" "scriptout/'$filename'_intermediate.txt"
done
вот моя структура каталогов: CVS scriptout тесты бин ЦСИ testscript.sh – MikeKusold
Вы испытываете проблемы с этим сценарием, что вы в поисках исправление? –
@ Geoffrey: Из второго абзаца вопроса: «Проблема в том, что перемещается только входной файл». –