Geek Challenge: Find the problem

Geek Challenge today bringso you the following. So I spend to long finding the error in the function below... see if you can find it.
#ksh snip
pb_src () {
    f_parent=$1
    f_child=$2
    f_src=$3
    f_comment=$4

    su - bob -c "putback -p $f_parent -w $f_child" -c\\"$f_comment\\"  $f_src
}
Man did I kick myself when I found the error... leave your guesses in the comments.

For what it's worth.

Comments:

the line with the 4 """"

Posted by guest on March 14, 2005 at 05:41 AM EST #

Well Mr. Anonymous... since that is the only line w/ that executes anything it is sorta a given.... what is wrong?

Posted by Dan Lacher on March 14, 2005 at 05:44 AM EST #

I'm only guessing -- second -c is treatened as a second command switch by "su" ? (probably there should be "--" added after first "-c" occurance). But I'm tired and only guessing ;-)

Posted by Adam Kruszewski on March 14, 2005 at 06:41 AM EST #

Without testing it, I would guess that you passed in two -c commands to the su command (with some garbage at the end) instead of one putback command with its own -c argument. I think su just runs the last -c command you pass it.

Now, find the three typo errors in your introductory sentence! :)

Posted by Kevin on March 14, 2005 at 06:45 AM EST #

So for all of those reading... here is where the problem was:

su - bob -c "putback -p $f_parent -w $f_child<FONT COLOR=RED>"</FONT> -c\\"$f_comment\\" $f_src
su - bob -c "putback -p $f_parent -w $f_child -c\\"$f_comment\\" $f_src<FONT COLOR=RED>"</FONT>

Notice the placement of the set of doubel quotes... man I hate it when it comes down to a quoting issue.

dl

Posted by Dan Lacher on March 15, 2005 at 12:44 AM EST #

Post a Comment:
Comments are closed for this entry.
About

dlacher

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today