Results 1 to 4 of 4

Thread: How to share variables between different shells?

  1. #1
    Junior Member Maniaxx's Avatar
    Join Date
    May 2008
    Posts
    38

    Default How to share variables between different shells?

    Hallo,
    a typical backtrack setup needs multiple shells like having one running airodump-ng and another to deauthenticate or similar. I like to put stuff like mac addresses, essid and such into variables to quickly get the appropriate command complete. What's a nice way to share these variables among different shells (in KDE)? The 'export' command doesn't work here. Is it possible to spawn a new child shell (new window) out of an existing shell that will inherit parent variables? How do you personally share data/variables among different shells? I currently copy&paste stuff. That's not very comfortable.


  2. #2
    Very good friend of the forum Gitsnik's Avatar
    Join Date
    Jan 2010
    Location
    The Crystal Wind
    Posts
    851

    Default Re: How to share variables between different shells?

    You could include a script file at the end of your bash logon script that will correctly load the variables. Then all you have to do is spawn a new shell and away you go.

    If you spawn a shell it will create its own environment ignoring the ones above it, so this is really the only way to do it.

    Code:
    bash-3.2$ GITSNIK=variable
    bash-3.2$ echo $GITSNIK
    variable
    bash-3.2$ /bin/bash
    bash-3.2$ echo $GITSNIK
    
    bash-3.2$
    Personally I save to a single file (e.g. NETGEAR.txt) and then use a simple grep/sed bash script I wrote to loadvars.sh NETGEAR.txt. It's not as pleasant as the automated scripts that kick around, but I like having the file in place so I can go back to that point later on without having to redo all my research.
    Still not underestimating the power...

    There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.

  3. #3
    Junior Member Maniaxx's Avatar
    Join Date
    May 2008
    Posts
    38

    Default Re: How to share variables between different shells?

    Hmm... when i run a bash script like 'export qqq=111' variable remains empty. How exactly looks your loadvars script?

  4. #4
    Very good friend of the forum Gitsnik's Avatar
    Join Date
    Jan 2010
    Location
    The Crystal Wind
    Posts
    851

    Default Re: How to share variables between different shells?

    Something like
    Code:
    ESSID=$(grep -E '^ESSID: ' ~/.scratch/wpa.txt | awk '{print $2}')
    Run automatically each time a shell is loaded. The extra couple of variables aren't a big deal.
    Still not underestimating the power...

    There is no such thing as bad information - There is truth in the data, so you sift it all, even the crap stuff.

Similar Threads

  1. multiple shells open w/ vmware bt distro
    By bullparade in forum Beginners Forum
    Replies: 2
    Last Post: 07-30-2010, 06:09 PM
  2. Replies: 6
    Last Post: 06-19-2010, 06:51 PM
  3. BT3 Environmental Variables
    By loftrat in forum OLD BT3final Support
    Replies: 1
    Last Post: 01-19-2009, 10:01 AM
  4. How to use variables in other console-windows ??
    By chrisrace in forum OLD Newbie Area
    Replies: 5
    Last Post: 11-02-2007, 06:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •