Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-24-2011, 01:30 PM
|
#1
|
|
LQ Newbie
Registered: Sep 2011
Posts: 8
Rep: 
|
[Backup Script] syntax error near unexpected token `else'
Hello,
i was scripting a Backup Script, that would 7zip a Folder,
what i have is this:
Code:
#!/bin/bash
###############################################################################
# Backup Script of BigWorld Server (by Cr0nixx) #
# Version 0.3 #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
###############################################################################
##### Variables
TIMESTAMP=`date +%H:%M_%d.%m.%Y`
var="."
LOG="/home/bigworldbackup/logs/${TIMESTAMP}.log"
size3=10737418240 # 10 gb space
size=`du -sb /home/bigworldbackup/backups`
size2=`du -sb /home/bigworld`
size4="echo -e "${size%%$'\t'*}+${size2%%$'\t'*}" | bc"
counter=$(wc -l < fail.log )
SUBJECT="[BigWorld-Backup-ERROR]"
EMAIL="test@test.de"
EMAIL2="test@test.de"
FINISH="[BigWorld-Backup-Success]"
SERROR="[BigWorld-Backup-FATALERROR]"
##### Variabels end!
#MainCode
if [ -z "$PS1" ]
then
clear
echo -e "\033[36m###############################################################################"
echo -e "\033[36m# Backup Script of BigWorld Server (by Cr0nixx) #"
echo -e "\033[36m# Version 0.3 #"
echo -e "\033[36m#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#"
echo -e "\033[36m###############################################################################"
sleep 0.5
echo -en "\033[35mChecking if Backup Script of BigWorld Server is running already! ";sleep 0.5;echo -en ".";sleep 0.5;echo -en ".";sleep 0.5;echo -en ".\n"
if [ -f /home/bigworldbackup/bigworldbackuplock.log ]
then
#was found
echo -e "\n\033[31mERROR:[BigWorldbackuplock.log] was found!"
echo -e "\033[31mScript is already running!"
echo -e "\033[31mTry again in a few Minutes!"
echo -e ""
echo -e "\033[31m----------------------------------------------------"
echo -e "\033[31m#\033[33m If this is not going to fix it, contact Cr0nixx! \033[31m#"
echo -e "\033[31m----------------------------------------------------"
echo -e ""
echo -en "\033[35mWriting failed attempt to the Fail.log File! ";sleep 0.4;echo -en ".";sleep 0.4;echo -en ".";sleep 0.4;echo -en ".\n"
echo "Fail" >> fail.log
echo -en "\033[35mChecking if we had at least 3 'Fails'";sleep 0.3;echo -en ".";sleep 0.3;echo -en ".";sleep 0.3;echo -en ".\n"
if [ "2" -ge "$counter" ]
then
echo -e "\n\033[32mNope, just $counter Fail(s), try again later!\033[0m"
echo -e "\033[36m###############################################################################\033[0m"
else
echo -en "\033[31mMore than 3 Fails, sending Email! ";sleep 0.4;echo -en ".";sleep 0.4;echo -en ".";sleep 0.4;echo -en ".\n"
mutt -s $SUBJECT -a /home/bigworldbackup/bigworldbackuplock.log $EMAIL $EMAIL2 < /home/bigworldbackup/failemail.txt
echo -e "\033[35mEmail finished, clearing Fail.log"
echo -n "" > fail.log
echo -e "\033[32mDone!\033[0m"
echo -e "\033[36m###############################################################################\033[0m"
fi
else
#was not found
echo -e "\n\033[32mINFO:[BigWorldbackuplock.log] was not found!\n"
echo -en "\033[35mCreating BigWorldbackuplock.log";sleep 0.3;echo -en ".";sleep 0.3;echo -en ".";sleep 0.3;echo -en ".\n"
echo "Process running since: $TIMESTAMP" > bigworldbackuplock.log
echo -e "\033[32mCreated lock File!"
echo -en "\n\033[35mChecking if we have enough Space!";sleep 0.3;echo -en ".";sleep 0.3;echo -en ".";sleep 0.3;echo -en ".\n"
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
echo -e "NO SPACE LEFT DELETING FILES OLDER THAN 15 DAYS" | tee -a $LOG
find /home/bigworldbackup/backups -name "*.7z" -type f -mtime +15 -exec rm {} \;
find /home/bigworldbackup/logs -name "*.log" -type f -mtime +15 -exec rm {} \;
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
echo -e "NO SPACE LEFT DELETING FILES OLDER THAN 10 DAYS" | tee -a $LOG
find /home/bigworldbackup/backups -name "*.7z" -type f -mtime +10 -exec rm {} \;
find /home/bigworldbackup/logs -name "*.log" -type f -mtime +10 -exec rm {} \;
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
echo -e "NO SPACE LEFT DELETING FILES OLDER THAN 5 DAYS" | tee -a $LOG
find /home/bigworldbackup/backups -name "*.7z" -type f -mtime +5 -exec rm {} \;
find /home/bigworldbackup/logs -name "*.log" -type f -mtime +5 -exec rm {} \;
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
echo -e "NO SPACE LEFT, EVEN AFTER DELETING FILES OLDER THAN 5 DAYS, sending Email!" $LOG
mutt -s $SERROR $EMAIL $EMAIL2 < /home/bigworldbackup/fatal.txt
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
fi
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
fi
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
fi
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
echo -e "\033[32mStarting backup of Bigworld at ${TIMESTAMP}"
echo -e "Starting Backup in ...3"
sleep 1
echo -e " ...2"
sleep 1
echo -e " ...1"
sleep 1
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
echo -e "\033[36m###############################################################################\033[0m"
fi
fi
else # ERROR IS RIGHT IN HERE!
if [ -f /home/bigworldbackup/bigworldbackuplock.log ]
then
echo "Fail" >> fail.log
if [ "2" -ge "$counter" ]
then
exit
else
mutt -s $SUBJECT -a /home/bigworldbackup/bigworldbackuplock.log $EMAIL $EMAIL2 < /home/bigworldbackup/failemail.txt
echo -n "" > fail.log
if
else
echo "Process running since: $TIMESTAMP" > bigworldbackuplock.log
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
find /home/bigworldbackup/backups -name "*.7z" -type f -mtime +15 -exec rm {} \;
find /home/bigworldbackup/logs -name "*.log" -type f -mtime +15 -exec rm {} \;
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
find /home/bigworldbackup/backups -name "*.7z" -type f -mtime +10 -exec rm {} \;
find /home/bigworldbackup/logs -name "*.log" -type f -mtime +10 -exec rm {} \;
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
find /home/bigworldbackup/backups -name "*.7z" -type f -mtime +5 -exec rm {} \;
find /home/bigworldbackup/logs -name "*.log" -type f -mtime +5 -exec rm {} \;
if [ ${size4%%$'\t'*} -gt ${size3} ]
then
mutt -s $SERROR $EMAIL $EMAIL2 < /home/bigworldbackup/fatal.txt
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
fi
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
fi
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
fi
else
echo -e "Starting backup of Bigworld at ${TIMESTAMP}" >> $LOG
7za a -mx9 -mmt -t7z ${TIMESTAMP}.7z /home/bigworld | tee -a $LOG
echo -e "\033[32mBackup finished!" | tee -a $LOG
echo -e "Moving $TIMESTAMP.7z to /home/bigworldbackup/backups!" | tee -a $LOG
mv "${TIMESTAMP}.7z" "/home/bigworldbackup/backups/${TIMESTAMP}.7z"
echo -e "Everything is done, Backup was successfull." | tee -a $LOG
rm -f /home/bigworldbackup/bigworldbackuplock.log
echo -e "Deleted bigworldbackuplock.log, shutting down!" | tee -a $LOG
mutt -s $FINISH -a /home/bigworldbackup/logs/$TIMESTAMP.log $EMAIL $EMAIL2 < /home/bigworldbackup/successemail.txt
fi
fi
fi
I know that the Code is written badly, but its my third Script.
Running it outputs this:
Code:
./test.sh: line 153: syntax error near unexpected token `else'
./test.sh: line 153: ` else'
But the "else" is fitting perfectly there for me ...
Any fix?
Thanks a ton!
Last edited by Cr0nixx; 09-24-2011 at 01:40 PM.
|
|
|
|
09-24-2011, 01:41 PM
|
#2
|
|
Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 6,325
|
So did you go to the line in the code? Seems fairly obvious:
Code:
echo -n "" > fail.log
if
else
echo "Process running since: $TIMESTAMP" > bigworldbackuplock.log
|
|
|
1 members found this post helpful.
|
09-24-2011, 01:43 PM
|
#3
|
|
LQ Newbie
Registered: Sep 2011
Posts: 8
Original Poster
Rep: 
|
Quote:
Originally Posted by grail
So did you go to the line in the code? Seems fairly obvious:
Code:
echo -n "" > fail.log
if
else
echo "Process running since: $TIMESTAMP" > bigworldbackuplock.log
|
right wrote if, should be fi 
Testing: Working fine, only got this error ./test.sh: line 70: [: too many arguments
thats this line:
Code:
size3=10737418240 # 10 gb space
size=`du -sb /home/bigworldbackup/backups`
size2=`du -sb /home/bigworld`
size4="echo -e "${size%%$'\t'*}+${size2%%$'\t'*}" | bc"
if [ ${size4%%$'\t'*} -gt ${size3} ]
Last edited by Cr0nixx; 09-24-2011 at 01:48 PM.
|
|
|
|
09-24-2011, 02:14 PM
|
#4
|
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,589
|
First of all, please don't use php code tags. For some reason they don't wrap properly, and cause very annoying side scrolling. Not to mention that this is a bash script, not php. Just use regular code tags like everyone else.
Second, your code is really hard to parse. You need to break up sections with blank lines, so that each loop can be more clearly seen as a separate unit. That alone would probably help you to parse out your error.
Making sure all the keywords in the loops and constructs line up on the same column would also help. Try putting the " do/ then" keywords on the same line as the for/ while/ if, and line up the beginning and ending keywords. i.e. for should line up with done, if with fi, case with esac, etc. Then line up all subcommands on the same column inside the construct. In short, every command at the same logical nesting level should start on the same column.
Finally, realize that the line given in the error message is the point at which the syntax parser becomes too confused to continue processing the commands. This is not always the point where the error exists. It may be that you have forgotten to close up a command somewhere further up, and it doesn't cause an error until the parser hits something further down that conflicts with it. So start walking your way backwards from the error point until you find the actual syntax error.
Now let's look at one of the code blocks near the place where you got the error:
Code:
if [ -f /home/bigworldbackup/bigworldbackuplock.log ]; then
echo "Fail" >> fail.log
if [ "2" -ge "$counter" ]
then
exit
else
mutt -s $SUBJECT -a /home/bigworldbackup/bigworldbackuplock.log $EMAIL $EMAIL2 < /home/bigworldbackup/failem$
echo -n "" > fail.log
if
else
If we apply the formatting suggestions I made above, it would look more like this:
Code:
if [ -f /home/bigworldbackup/bigworldbackuplock.log ]; then
echo "Fail" >> fail.log
if [ "2" -ge "$counter" ]; then
exit
else
mutt -s $SUBJECT -a /home/bigworldbackup/bigworldbackuplock.log $EMAIL $EMAIL2 < /home/bigworldbackup/failem$
echo -n "" > fail.log
if
else
Well, look at that. Assuming I'm properly picking the loop out of your code, it appears that your if statement is closed by another if, rather than the fi it should have been closed with. 
Last edited by David the H.; 09-24-2011 at 02:17 PM.
Reason: Removed superfluous misedit
|
|
|
1 members found this post helpful.
|
09-24-2011, 02:30 PM
|
#5
|
|
LQ Newbie
Registered: Sep 2011
Posts: 8
Original Poster
Rep: 
|
@ David the H.
Thanks
Sorry for this Mess, but im a Beginner and learning
anyone got a solution for this?
Code:
size3=10737418240 # 10 gb space
size=`du -sb /home/bigworldbackup/backups`
size2=`du -sb /home/bigworld`
size4="echo -e "${size%%$'\t'*}+${size2%%$'\t'*}" | bc"
if [ ${size4%%$'\t'*} -gt ${size3} ] # too many arguments here :/
|
|
|
|
09-24-2011, 02:35 PM
|
#6
|
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,589
|
Here's another suggestion. You'd make your code even more readable by moving repetitive commands into functions.
All of these find commands, in particular:
Code:
find /home/bigworldbackup/backups -name "*.7z" -type f -mtime +15 -exec rm {} ;
I'd put these into a function like this at the top of the script:
Code:
removefiles() {
#Use the find command to remove files of a certain type and age.
#$1 is the directory to search.
#$2 is the pattern to search
#$3 is the mtime range to match
find "$1" -name "$2" -type f -mtime "$3" -exec rm {} \+ # (or gnu find has a -delete option)
}
...And call it like this:
Code:
removefiles '/home/bigworldbackup/backups' '*.7z' '+15'
I'd also add a few more comments explaining the logic behind what the code is doing. You'll be happy you did a few years down the line when you review the code and wonder just what the heck you were high on when you wrote it. 
|
|
|
1 members found this post helpful.
|
09-24-2011, 02:47 PM
|
#7
|
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,589
|
Quote:
Originally Posted by Cr0nixx
anyone got a solution for this?
Code:
if [ ${size4%%$'\t'*} -gt ${size3} ] # too many arguments here :/
|
[ is a command, just like any other, with the entries following it all being arguments to that command (with a closing bracket being the last argument). In the pattern " x -gt y", there are logically only 3 arguments: x, -gt, and y.
So are there three arguments? What do the variables ${size4%%$'\t'*} and ${size3} actually output? Remember that word-splitting occurs when you don't quote variables.
Try inserting set -x and set +x before and after the affected to toggle verbose output, which will help you debug what your script is doing.
But actually, in bash, arithmetic arguments are better tested with ((..)), and string arguments with [[..]].
http://mywiki.wooledge.org/ArithmeticExpression
http://mywiki.wooledge.org/BashFAQ/031
There's more on debugging and other good code practices here:
http://mywiki.wooledge.org/BashGuide/Practices
|
|
|
1 members found this post helpful.
|
09-24-2011, 02:51 PM
|
#8
|
|
LQ Newbie
Registered: Sep 2011
Posts: 8
Original Poster
Rep: 
|
here you go
Code:
size3=10737418240 # 10 gb space
size=`du -sb /home/bigworldbackup/backups` # get size of the folder ,where the backups are stored.
size2=`du -sb /home/bigworld` # get size of the folder to backup
size4="echo -e "${size%%$'\t'*}+${size2%%$'\t'*}" | bc" #size + size2 = size4
if [ ${size4%%$'\t'*} -gt ${size3} ] # too many arguments here :/ | if size 4 bigger than size3(10gb) than delete old backups, if not do backup
Last edited by Cr0nixx; 09-24-2011 at 02:55 PM.
|
|
|
|
09-24-2011, 03:06 PM
|
#9
|
|
Senior Member
Registered: Jan 2010
Posts: 1,604
|
Quote:
Originally Posted by Cr0nixx
here you go
Code:
size3=10737418240 # 10 gb space
size=`du -sb /home/bigworldbackup/backups` # get size of the folder ,where the backups are stored.
size2=`du -sb /home/bigworld` # get size of the folder to backup
size4="echo -e "${size%%$'\t'*}+${size2%%$'\t'*}" | bc" #size + size2 = size4
if [ ${size4%%$'\t'*} -gt ${size3} ] # too many arguments here :/ | if size 4 bigger than size3(10gb) than delete old backups, if not do backup
|
Hi,
I think you are missing the command substitution. What you probably want is:
Code:
size3=10737418240 # 10 gb space
size=`du -sb /home/bigworldbackup/backups` # get size of the folder ,where the backups are stored.
size2=`du -sb /home/bigworld` # get size of the folder to backup
size4=$(echo -e "${size%%$'\t'*}+${size2%%$'\t'*}" | bc) #size + size2 = size4
if [ ${size4} -gt ${size3} ] # too many arguments here :/ | if size 4 bigger than size3(10gb) than delete old backups, if not do backup
Notice, that you do not need String manipulation for $size4 since it does not contain any tabs.
|
|
|
1 members found this post helpful.
|
09-24-2011, 03:10 PM
|
#10
|
|
LQ Newbie
Registered: Sep 2011
Posts: 8
Original Poster
Rep: 
|
@ crts
Thank you very much its working 
|
|
|
|
09-24-2011, 03:19 PM
|
#11
|
|
Senior Member
Registered: Jan 2010
Posts: 1,604
|
You are welcome. If there are no other errors then please mark the thread as solved.
|
|
|
|
09-24-2011, 04:32 PM
|
#12
|
|
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,589
|
Go ahead and replace all the other `..` backticks with $(..) as well, while you're at it.
http://mywiki.wooledge.org/BashFAQ/082
Speaking of which, how do you newbies keep getting taught the old form anyway? The new syntax has been around for ages, is defined by posix, and is supported by all the major bourne-based shells. All of the guides I've ever seen make it clear that the backticks are deprecated. So just where are you getting your scripting information? 
|
|
|
|
09-27-2011, 01:37 PM
|
#13
|
|
Member
Registered: May 2006
Location: Bayern, Germany
Distribution: Many
Posts: 224
Rep:
|
I'd like to recommend another good website for anybody wanting to learn more about bash scripting. It helped me many times!
http://wiki.bash-hackers.org/start
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:28 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|