Ich habe es mal so abgeändert:
Code:
# Function blubbel
#function schleifen () {
# ${path}${project}/*.txt | while read -r file
# do
# cat ${file} >> ${path}${project}/ergebnis.txt
# echo -e "\n" >> ${path}${project}/ergebnis.txt
# done
#}
(Dass es auskommentiert ist, bitte nicht beachten^^).
Jetzt meckert er herum, er hätte keine Permission für text1.txt und erstellt somit keine ergebnis.txt :/
PS: Kann man eine Funktion nicht in einer anderen Funktion aufrufen?
Code:
function schleifen () {
$count
for file in ${path}${project}/*.txt
do
if [${count} == ${count}]
then
cat ${file} > ${path}${project}/ergebnis.txt
echo -e "\n" >> ${path}${project}/ergebnis.txt
count--
$count
elif [${count} == 1]
then
cat ${file} >> ${path}${project}/ergebnis.txt
count--
$count
else
cat ${file} >> ${path}${project}/ergebnis.txt
echo -e "\n" >> ${path}${project}/ergebnis.txt
fi
done
}
sowie
Code:
count="count_files"
function count_files () {
current_to_destination
ls *.txt | wc -l
cd ${current_path}
}
Ausgabe:
Code:
baum2.sh: line 37: [count_files: command not found
baum2.sh: line 43: [count_files: command not found
baum2.sh: line 37: [count_files: command not found
baum2.sh: line 43: [count_files: command not found
Edit:
Ach, musste [ Bedingung ] machen, also Leerzeichen einfügen Ich Knilch
Allerdings kennt er das Decrement count-- bzw. auch $count-- nicht ^^
Lesezeichen