I want to create a script that will create an environment variable that will hold a folder name called "templates". After I create the global variable with the script , I would be able to get to the path of the folder name automatically on the command line, without typing the path again and again.

Can you please suggest ideas.



  • unclear what you're asking. Can you show us what you want to type at the command line? – glenn jackman Oct 25 '17 at 22:05
  • what's unclear about it? – captcha Oct 25 '17 at 22:10

use export for this.


echo "export T=templates" > setvar
. setvar


cd $T

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.