How to set a shell variable Commands Add comments Jan 112010 How to set a shell variable Answer: Use the export command # export foo=bar # echo $foo bar Related posts: How to unset an environment variable in bash How to avoid command being saved to shell history What are PHP variable variables? How to add a directory into the PATH environment variable? How do I know if I am running a shell inside another shell? Leave a Reply Cancel reply Name (required) E-mail (required) URI Your Comment You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>