Shell script

Hi,
I am missing a small point here and could not figure out the solution
I have to create some enviornment variables in bash
I do the following
1) create a file "script"
2) chmod 755 script
3) edit the file and write the following
PRINTER=PostScript;
export PRINTER
4) ./script
5) set | grep PRINTER gives me nothing...I was expecting the enviornment variable to be set..I donno whats up ?
Thanks
Kapil

Comments

  • I don't actually know the answer, but this is a short-term fix:
    [code]
    $ `cat script`
    [/code]
    Yeah, cheesy ;). I had this problem a while ago while writting a script to setup CVS environment variables so that I didn't have to do it manually, I just stuck with that solution.
  • : Hi,
    : I am missing a small point here and could not figure out the solution
    : I have to create some enviornment variables in bash
    : I do the following
    : 1) create a file "script"
    : 2) chmod 755 script
    : 3) edit the file and write the following
    : PRINTER=PostScript;
    : export PRINTER
    : 4) ./script
    : 5) set | grep PRINTER gives me nothing...I was expecting the enviornment variable to be set..I donno whats up ?
    : Thanks
    : Kapil
    :
    :
    You need to make the script part of your environment like so
    . ./script
    You executed the script, which makes the env variables stick around until
    the script is done. Please note, executing a script and making a script
    part of your environment are not the same thing at all.

  • : I have to create some enviornment variables in bash

    You could just add this line to one of the bash dotfiles,
    usually either ~/.profile or ~/.bashrc

    export PRINTER=PostScript


  • [b][red]This message was edited by opensource at 2002-9-25 20:42:45[/red][/b][hr]
    Try $prompt>env | grep PRINTER

    : Hi,
    : I am missing a small point here and could not figure out the solution
    : I have to create some enviornment variables in bash
    : I do the following
    : 1) create a file "script"
    : 2) chmod 755 script
    : 3) edit the file and write the following
    : PRINTER=PostScript;
    : export PRINTER
    : 4) ./script
    : 5) set | grep PRINTER gives me nothing...I was expecting the enviornment variable to be set..I donno whats up ?
    : Thanks
    : Kapil
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories