LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-17-2012, 01:04 PM   #1
aalyatim
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
Bash Question:line 33: syntax error: unexpected end of file


I am having a problem with my code outputting error unexpected end of file. I know its a problem with the last for loop but I can't figured it out. Anyone ideas?

Code:
#!/bin/bash
usage="Usage: $0 -w 'AT syntax' -m 'exact syntax needed' -u 'user1,user2,user3,etc'"
while getopts ":m:w:u:" opt;
do
case $opt in
        m) m=$OPTARG
        ;;
        w) w=$OPTARG
        ;;
        u) u=$OPTARG 
        ;;
esac
done
old_IFS=$IFS
IFS=','
users=($u)
IFS=$old_IFS
if [ "${#m}" -lt 1 ]; then
echo "-m is not set"
echo $usage
exit 1
fi
for a in ${#users[@]}
do
echo ${users[a]}
if [ "${#w}" -gt 0 ]; then 
at $w << /tmp/275/aa6vd/alert.p5/send $a $m
else 
./send $a $m
fi
done
exit 1
 
Old 10-17-2012, 01:18 PM   #2
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Code:
at $w << /tmp/275/aa6vd/alert.p5/send $a $m
What did you mean by this line of code? What you wrote starts a here document and you haven't closed it, thus unexpected end of file.

Also, your code will be much easier to read if you indent it properly and add a few blank lines between sections.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
diskspace.sh: line 10: syntax error: unexpected end of file sandeepreddy.bommineni Linux - Newbie 2 01-12-2012 05:37 AM
Error in Bash: line 77: syntax error: unexpected end of file bribon Programming 8 07-13-2011 12:43 PM
line 313: syntax error: unexpected end of file bes Linux - Newbie 3 05-02-2010 03:32 AM
-bash: *.sh: line 25: syntax error: unexpected end of file prashanth212 Linux - General 8 04-05-2010 11:52 PM
bash line 74: syntax error: unexpected end of file help? andycol Linux - General 5 09-14-2009 08:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration