User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion
Register FAQ Members List Calendar Arcade Today's Posts

Reply
Thread Tools Display Modes
Unread 5 Apr 2003, 07:33   #1
Atheist
Registered User
 
Join Date: Jul 2002
Location: U.S.
Posts: 28
Atheist is an unknown quantity at this point
Bash script problem

Hi guys,

A friend of mine is having a problem with a bash script hes working on. I was hoping you could help him out. He already started a post over at WHT which can be found here . If you guys can help, either post here or there it matters not. Thanks!
__________________
do not let anyone decieve you with the legitimization of their myth
Atheist is offline   Reply With Quote
Unread 5 Apr 2003, 09:21   #2
Atamur
Ngisne
 
Join Date: Jul 2001
Location: right here
Posts: 79
Atamur is an unknown quantity at this point
I think your friend needs to replace
Code:
install_softA $*
with
Code:
install_softA "$@"
[edit]i haven't done any shell scripting in a few years so i could be wrong[/edit]
__________________
down with signatures
Atamur is offline   Reply With Quote
Unread 5 Apr 2003, 10:06   #3
Atheist
Registered User
 
Join Date: Jul 2002
Location: U.S.
Posts: 28
Atheist is an unknown quantity at this point
Well slidey took care of it just a bit ago, thanks for the reply though!
__________________
do not let anyone decieve you with the legitimization of their myth
Atheist is offline   Reply With Quote
Unread 5 Apr 2003, 20:01   #4
Mong
Forever Delayed
 
Join Date: Sep 2000
Location: www.netgamers.org
Posts: 1,475
Mong is on a distinguished road
Quote:
Originally posted by Atheist
Well slidey took care of it just a bit ago, thanks for the reply though!
Post the solution, so we may all learn!!

M.
__________________
Firefly Oper and General l4m3r - "I Do Stuff"

O2 Rip-off campaign

<vampy> plus i hate people ... i despise humanity as a whole

pablissimo "I'm still geting over the fact you just posted a pic of your own vomit"
Mong is offline   Reply With Quote
Unread 6 Apr 2003, 20:34   #5
Joop
Registered User
 
Join Date: May 2001
Posts: 4
Joop is an unknown quantity at this point
The solution can be found on the page which contained the original question.
Joop is offline   Reply With Quote
Unread 7 Apr 2003, 09:05   #6
Slidey
Registered User
 
Join Date: Mar 2001
Posts: 205
Slidey is an unknown quantity at this point
basically the $* and $@ were expanding hte arguments by any spaces, as it seemed to take $1 - $x as one string.. so when we had $5 as "this argument" it expanded it to $5 = this and $6 = argument..

all we did was store each argument in its own variable and pass them individually..

i bet there was an easier version but it worked and it was quick and it meant the guy could carry on his work
__________________
#linux - home of idiots

#impulsed - home of genius..?
Slidey is offline   Reply With Quote
Unread 7 Apr 2003, 12:02   #7
Atamur
Ngisne
 
Join Date: Jul 2001
Location: right here
Posts: 79
Atamur is an unknown quantity at this point
Quote:
Originally posted by Slidey
basically the $* and $@ were expanding hte arguments by any spaces, as it seemed to take $1 - $x as one string.. so when we had $5 as "this argument" it expanded it to $5 = this and $6 = argument..

all we did was store each argument in its own variable and pass them individually..

i bet there was an easier version but it worked and it was quick and it meant the guy could carry on his work
"$@" (quotes are significant) quotes each $n variable individually.

Code:
~>cat t.sh
#!/bin/bash
a() {
  echo "$3"
}

a $*
a "$@"
~>./t.sh a b "c d"
c
c d
So as I posted earlier, simply replacing $* with "$@" in the function call would probably solve his problem (unless I'm missing something).
__________________
down with signatures
Atamur is offline   Reply With Quote
Reply



Forum Jump


All times are GMT +1. The time now is 18:19.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018