Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have this funny little script, its suppose to make me a tone of users. But right now I am getting an error about unexpected end of file. I am sure many of you have come across this before, and many people raising this question, god knows google certainly gave a ton of stuff to read through, but still nothing really fixed it.
Here is the code, I have removed a whole bunch of the actual user creation because I have already ruled them out. I removed those chunks, ran it again, and still got the same errors.
Code:
#******************************************************************************
#
# Usage: ./Add_Subscriber.sh user id how many ids
# e.g. ./Add_Subscriber.sh 4932782111000 10 will add 4932782111000-4932782111009
#
# Version PA1
#*****************************************************
i_loop=0
while [ $i_loop -lt $2 ]; do
i_subscriber=`expr $1 + $i_loop`
echo loop number: $i_loop
echo Writing subsriber: $i_subscriber
#removed a bunch of stuff here
i_loop=`expr $i_loop + 1`
done
any help you guys can provide I would really appreciated it.
I looked for extra CRs and etc, but still couldn't find anything.
the linux is running some kind of corporate modified suse 11.
Last edited by jzoudavy; 08-12-2012 at 05:20 PM.
Reason: text editor messed up some of the formatting
missing lines are comments containing private information, which i can't really post on a public forum.
hi chrism01
I tried the !/bin/bash, I still get the same error about unexpected end of file.
Actually !/bin/bash gave an error about bad interpretor and I had to change it to ./bin/bash instead.
I also had to take out set -vx because it doesn't like the way I set the options, according to man i am suppose to use --, but that just gave me the same error.
sorry if I sound a bit short, this is the 3rd time i am typing this because the token keeps expiring.
You have created the file in Windows and hence the unusual line endings are causing issues. See chrism01's link about dos2unix.
Also, the reason the bash section was causing you errors is you missed or mis-read chrism01's example and left off the leading #, the hash is required
as together with ! it tells the script which interpreter to use. I would suggest that without this being set correctly would be the reason why 'set' was
misbehaving for you.
Depends on whether notepad++ overwrites any changes when you save and puts the windows line endings back in?
Simple test would be to change file you have run dos2unix on in notepad++ and then use cat -A in linux and see what the output is.
To check it is correct create a simple file on linux (echo word > test_file) and use the same cat -A
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.