Take the 2-minute tour ×

Can anyone why this code is not working?

echo "Welcome to automatic code check"

echo "Hello $USER, Welcome to CODE CHECK"
echo "The Date & Time is:"

read -p "Enter foldername in downloads : " Foldername
echo -e "Please enter a directory name to be created"

read DIRK
if [ ! -d $DIRK ]
    mkdir  ~/Downloads/$DIRK                
    echo -e "Directory $DIRK created"
    #read -p "enter file name:" filename
    find ~/Downloads/$Foldername -type f -iname '*.sce' -print0 |
    while IFS= read -r -d '' f; 
    do cp -- "$f" ~/Downloads/$DIRK ;

    FILES= "~/Downloads/$DIRK/*.sce"

    #read -p "enter filename where result should be saved : " Filename
    #touch ~/Downloads/$DIRK/$Filename
     for f in $FILES; do
        scilab  -nb -nwni -ns -f "$f"  & 
        let count+=1
#[[ $((count%NR_CPUS)) -eq 0 ]] && wait
    done >> a.txt
    echo -e "$DIRK directory already exists!"
    echo -e "1.Faild to create $DIRK directory, Directory already exists"
share|improve this question
Hi @Lavitha, welcome to SO. You are likely to get a better response to your question if you can put it more clearly - exactly what are you expecting to happen, and what is actually happening? Can you pin it down any more closely within the script you posted? –  Vicky Feb 13 '13 at 10:42
agree, please be more specific. As a hint add: set -x line somewhere at the beginning of your script to see how each line of your script is executed - maybe you will find problem by yourself!. Good luck. –  mzet Feb 13 '13 at 11:00
add comment


Your Answer



Browse other questions tagged or ask your own question.