Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 20-Feb-2008, 19:00
cretinator
Guest
 
Posts: n/a
Default

Ok for the record let me start off by saying I'm *very* new to Suse and fairly new to linux in general. Anyway I have to install some software for school purposes, it's basically a program that submits homeworks. Anyway it's packaged as a shell script which when ran is supposed to unzip various .rpm's. When I run the script from terminal using . <script name> though it returns the following.

LPL v2.5.0 - starting installation.

awk: cmd. line:1: fatal: cannot open file `bash' for reading (No such file or directory)
. extracting RPMs
tail: +: invalid number of lines

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error exit delayed from previous errors
. installing RPMs
error: File not found by glob: *.rpm
Installation complete (if no errors were shown!).
Script done, file is mysession.log

Now being new to linux I have only a feint idea of what's even going on in that error and even less of an idea on how to fix it. However any help would be greatly appricated in fact if someone can fix this for me they'll officially be my savior. Need it to run for school after all.
  #2 (permalink)  
Old 20-Feb-2008, 19:06
ken_yap
Guest
 
Posts: n/a
Default

The construct

. file

doesn't run a script. What it does is read in the file and execute the lines in it as if they had been typed into the current shell. The difference could be important.

To run a script, do

chmod u+rx script
./script

Do that and post the results.
  #3 (permalink)  
Old 20-Feb-2008, 19:25
cretinator
Guest
 
Posts: n/a
Default

Quote:
The construct

. file

doesn't run a script. What it does is read in the file and execute the lines in it as if they had been typed into the current shell. The difference could be important.

To run a script, do

chmod u+rx script
./script

Do that and post the results.
[/b]
That actually worked like a charm thanks! You're now offically my savior and I'll make sure to sing your praises at least once a day.
For the record though, just in an effort to learn. What is the difference between ./ and just . ?
  #4 (permalink)  
Old 20-Feb-2008, 19:32
ken_yap
Guest
 
Posts: n/a
Default

"./script" runs the script in the current directory. It actually runs the script in a separate process. ./ is just a prefix to refer to a file in the current directory.

". file" is called sourcing the file. It can also be typed in as "source file". It reads the contents of the file into the current interactive shell as if you had typed them in. It's not the same thing as running the script.

For details see man sh.
 

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2