I have to run a command every morning after I log on to the server to enable certain company specific functionalities.

The command looks like this: source /data/dev/int/default/somethingsomething.env

Is there a way to automate this so I don't have to copy/paste it?

  • What shell do you use? – Jeff Schaller Aug 15 '18 at 0:46
  • zsh apparently, had no idea how to even check this till now – solarflare Aug 15 '18 at 0:50
  • @Wildcard, I didn't see a zsh answer in there, so I went ahead and posted an Answer here. – Jeff Schaller Aug 15 '18 at 1:00
  • The "duplicate" was about sourcing a tcsh script when opening a terminal (that starts a bash shell on CentOS), quite different here. The answers there certainly don't apply here. – Stéphane Chazelas Aug 16 '18 at 13:13

Based on http://zsh.sourceforge.net/Doc/Release/Files.html#Files, I would recommend placing the command in your ~/.zshrc file.

Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc

Where ZDOTDIR can be set to override the default value of $HOME.

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.