This is the script.
I am getting these errors:
swap.sh: line 10: syntax error near unexpected token `then'
swap.sh: line 10: `then'
#first script
#script name is swap.sh
#check if correct number of arguments
if [ $# != 2 ]
then
echo "Error: wrong amount of arguments."
elif[ -f $1 ]||[ -f $2 ]
then
echo "Either the file" $1 "or the file" $2 "do not exist."
elif[ -r $1 ]||[ -r $2 ]
then
echo "Either the file" $1 "or the file" $2 "are not readable."
elif [ -w $1 ]||[ -w $2 ]
then
echo "Either the file" $1 "or the file" $2 "are not writable."
else
mv $1 temp1
mv $2 temp2
mv temp1 $2
mv temp2 $1
rm temp1
rm temp2
echo "The file" $1 "and the file" $2 "where succesfully swapped."
fi
exit
2007-03-24
14:57:57
·
1 answers
·
asked by
adrenalineguy87
2
in
Computers & Internet
➔ Programming & Design
Dude SteveN you are the freaking man. I changed the details you told me and used the test format i think its easier. I always have questions about unix script and C++ programming so I will be counting on you to answer several of my future questions. Thanks again man, you saved my ***!
2007-03-24
16:19:59 ·
update #1