#!/bin/ksh
while read line
do
cd $line/radmin
num=0
for file_nm in *.txt
do
\(\( check = $RANDOM % 2 \)\)
if [ $check -eq 0 ]; then
continue
fi
\(\( num = num \+ 1 \)\)
echo /bin/cp $PWD/$file_nm $PWD/newword$\{num\}.word
if [ $num -ge 6 ]; then
break
fi
done ### while doing random renaming....
done < source.txt
all newwordX.word not be created..
plz check it..
thanks
first of all use CODE tags while posting your code
#!/bin/ksh
while read line
do
cd $line/radmin
num=0
# /bin/ls *.txt | - you are trying list all the TXT files
# for file_nm in *.txt
for file_nm in *.txt
do
check=$(( $RANDOM % 2 ))
if [ $check -eq 0 ]; then
continue
fi
# (( num = num + 1 ))
num = $(( $num + 1 ))
echo /bin/mv $PWD/$file_nm $PWD/t_level${num}.words
if [ $num -ge 6 ]; then
break
fi
done
done < source.txt