chris_w3
January 8th, 2015, 09:34 PM
I'm getting this error when trying to execute the following script;
259105
It is giving me a syntax error stating that a 'do' is expected however there is already one there?
#script1.sh
#!/bin/bash
echo Source Folder
if [ -d "$1" ]
then
cd $1
for f in $1/*
do
procFiles "$f"
done
else
echo Working directory not found.
fi
# Wait for a key press ...
read -p "Press ENTER to continue"
clear
echo Target Folder
if [ -d "$1\target" ]
then
cd $1
echo Directory Found.
else
echo Working directory not found.
echo Creating directory
cd $1
mkdir target
fi
# Wait for a key press ...
read -p "Press ENTER to continue"
clear
#procFiles.sh
#!/bin/bash
ls -l "$1"
read -p "Copy(yes/no)?" yn
if [ "$yn" == "yes" ]
then
cp "$1" $1\target
chmod 444 $1
echo $1 Copied to target folder, file set to read only
else
echo $1 Skipped
fi
Any help would be highly appreciated
Thanks
259105
It is giving me a syntax error stating that a 'do' is expected however there is already one there?
#script1.sh
#!/bin/bash
echo Source Folder
if [ -d "$1" ]
then
cd $1
for f in $1/*
do
procFiles "$f"
done
else
echo Working directory not found.
fi
# Wait for a key press ...
read -p "Press ENTER to continue"
clear
echo Target Folder
if [ -d "$1\target" ]
then
cd $1
echo Directory Found.
else
echo Working directory not found.
echo Creating directory
cd $1
mkdir target
fi
# Wait for a key press ...
read -p "Press ENTER to continue"
clear
#procFiles.sh
#!/bin/bash
ls -l "$1"
read -p "Copy(yes/no)?" yn
if [ "$yn" == "yes" ]
then
cp "$1" $1\target
chmod 444 $1
echo $1 Copied to target folder, file set to read only
else
echo $1 Skipped
fi
Any help would be highly appreciated
Thanks