Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The title may not be much clear. I have written some scripts for housekeeping tasks on the Ubuntu servers we maintain. When ever there is a new deployment for a client, I have to change user ids, passwords and names of the servers etc. to make scripts usable in new setup.

Is there any way which help me to define all these things as variables and use then in all scripts. Like define them in a shell file and then access that file in all other scripts...?


an example backup script:


#..... actual script that uses values above and perform backup etc.

There are quite a few scripts like this that use variables. I want a common place to define them and then access in any script.

share|improve this question
@slhck I have edited question to add an example. – TheVillageIdiot Oct 27 '11 at 15:41
You could just dynamically generate the scripts. . . – surfasb Oct 27 '11 at 17:20
@surfasb would you please elaborate on this? – TheVillageIdiot Oct 27 '11 at 17:41

Put all the variables in a file, say "server.specific.variables". Then each script can include that file with
. server.specific.variables

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .