Re: .ini files in bash?

From: Nate Bargmann (n0nb_at_networksplus.net)
Date: 11/29/04

  • Next message: Mike M: "Re: remote build of Debian router"
    Date: Mon, 29 Nov 2004 15:51:03 -0600
    To: debian-user@lists.debian.org
    
    

    * Cameron Hutchison <camh+dl@xdna.net> [2004 Nov 29 15:15 -0600]:
    > Ok. I got bored and spend a minute writing this:
    >
    > function savevars()
    > {
    > for var in "$@" ; do
    > eval "echo $var=\\\"\$$var\\\""
    > done
    > }
    >
    >
    > Just call it like:
    > savevars VAR1 VAR2 VAR3 >file
    >
    > then load the vars with:
    > source ./file

    Very nice little code snippet. Thanks for posting this. I'm trying to
    learn more about shell scripting and I'm a bit puzzled why there are
    two escaped backslashes. After removing the obvious ones for quoting I
    get:

    $var=\"$$var\"

    So the embedded quotes have to be escaped again? I'm still learning
    about the magic of eval, so a little more explanation would be
    appreciated.

    - Nate >>

    -- 
     Wireless | Amateur Radio Station N0NB          |  Successfully Microsoft
      Amateur radio exams; ham radio; Linux info @  | free since January 1998.
                 http://www.qsl.net/n0nb/           |  "Debian, the choice of
                 My Kawasaki KZ-650 SR @            |     a GNU generation!"
            http://www.networksplus.net/n0nb/       |   http://www.debian.org
    -- 
    To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: Mike M: "Re: remote build of Debian router"