[Back to index]
[Back to Materiały dydaktyczne / Teaching resources]
Materiały do przedmiotu będą udostępniane na bieżąco w trakcie semestru.
#!/bin/bash
if [ ! -d ./parzyste ]
then
mkdir ./parzyste
fi
if [ ! -d ./nieparzyste ]
then
mkdir ./nieparzyste
fi
# Alternatywnie po prostu:
# mkdir -p parzyste nieparzyste
until [ $((`ls parzyste/file* 2>/dev/null | wc -l`+`ls nieparzyste/file* 2>/dev/null | wc -l`)) -eq 1366 ]
do
liczba=$RANDOM
if [ $(($liczba%2)) -eq 0 ]
then
if [ -e parzyste/file_$liczba ]
then
:
else
touch parzyste/file_$liczba
fi
else
if [ -e nieparzyste/file_$liczba ]
then
:
else
touch nieparzyste/file_$liczba
fi
fi
done
Copyright (c) 2017, 2018 M. Hermanowicz