Click to See Complete Forum and Search --> : linux shell scripting


shellme
05-26-2005, 01:44 PM
i cant get these simple scripts to work it says unexpected end of file.. please help

this is what the scripts are supposed to do..

Write a shell script that outputs the following statistics to a file named “system.txt”. It should include IRQs, DMAs, and I/O addresses.

Symbolically link to files and the output there link count and innode information to the terminal.

Write a script that shuts down the e0 interface at 21:00.

Write a shell script that the takes in the date and the date of a person’s birthday. The program should printout how many days until their birthday.

DrChuck
05-26-2005, 02:04 PM
So show us one of the scripts, as well as the actual error message when you try to run it.

Hayl
05-26-2005, 02:06 PM
is this homework?

Icarus
05-26-2005, 02:31 PM
Originally posted by Hayl
is this homework? If it's not someone needs to fix their keyboard :p
“system.txt”.person’s

The "unexpected end of file" means it's ending without exiting, which causes a bad memory leak and things get ugly from there.
Not knowing with kind of script means we can't tell you how to properly exit it. Is it Bash, Perl, Python...?

I'd suggest searching http://google.com/linux for lots of docs on scripting in various languages

bwkaz
05-26-2005, 09:32 PM
Either that, or somebody needs to stop pasting their posts from MS Word into the textbox here. Or remove all the "stupid quotes" that MS Word puts in there. :p

If you change your browser to use the UTF-8 character set (instead of the ISO8859-1 that I had it set to), that long string of characters will turn into the MS "stupid quotes" characters. You'll see quotes, apostrophes, everything.

It's basically a mismatch between the character set that the person used when submitting their post, and the character set that your browser uses as default. The forum doesn't seem to set anything when it sends the page to the rest of us, so it depends on the browser. The UTF-8 encoding for those "stupid quotes" is several bytes long, and many of those bytes are non-letters.

paj12
05-26-2005, 10:40 PM
Either that, or somebody needs to stop pasting their posts from MS Word into the textbox here. Or remove all the "stupid quotes" that MS Word puts in there.
Speaking of which, could the poster's problems be caused by the file being in DOS format? I've heard that if you write a script in Notepad or something and try to run it in Linux it won't work because bash expects a different character for line breaks, so you'd need to use dos2unix on it, right?

Icarus
05-27-2005, 09:51 AM
Yup, dos2unix will convert the carrage returns into proper unix format.

Try opening a unix script in notepad and you'll see the same thing with a ^M at the end of every line. unix2dos will also solve that too

bwkaz
05-27-2005, 07:33 PM
Originally posted by paj12
Speaking of which, could the poster's problems be caused by the file being in DOS format? Possibly, although the usual error from that is something about a "bad interpreter". If he's getting an "unexpected end of file", then I'd suspect it may be something like a mismatched if/fi or case/esac or do/end pair. If you forget the fi, esac, or end, you'll get that error or something like it.